.net
Custom conversion of specific objects in JSON.NET
If anyone’s interested in my solution: When serializing certain collections, I wanted to create an associative json array instead of a standard json array, so my colleague client side developer can reach those fields efficiently, using their name (or key for that matter) instead of iterating through them. consider the following: public class ResponseContext { … Read more
when to use {x:Type …} for Style TargetType?
There is no difference in effect; in both cases the TargetType property will be set to typeof(Border) The first version {x:Type Border} was needed in the first version of WPF because the compiler did not use the TypeConverter class to convert the string into a Type object and you needed to specify the TypeExtension class … Read more
EventLog write permissions
By default, any authenticated user is able to write to application event log. However only administrators can create new event Sources. If all event Sources are known at the service installation time, I recommend register those sources ahead of time, then you will be all set up. Registering is a simple call to EventLog.CreateEventSource. If … Read more
IL level code debugger
The best way to do this is to use ILDASM to disassemble the managed binary, which will generate the IL instructions. Then recompile that IL source code in debug mode using ILASM, when you fire up the Visual Studio debugger you will be able to step through the raw IL. ildasm foo.exe /OUT=foo.exe.il /SOURCE ilasm … Read more
AutoFixture vs NBuilder [closed]
Hi I was in the process of creating my own test builder when I ran into these two. I have tried both and found autofixture to be far preferable it has a richer syntax is extremely flexible and was easier to modify for my own use. Marks tests are excellent, well written and this mixed … Read more
Parse relative URI
Although you can create a Uri without a host portion, most of its properties will then throw an InvalidOperationException (“This operation is not supported for a relative URI”) because those properties rely on an absolute Uri. HttpUtility.ParseQueryString() is indeed not going to help here, because it only operates on the query part of an Uri, … Read more
Open Source .Net Reporting Tool [closed]
fyireporting (released under Apache License) is worth a try. The fyiReporting RDL Project is a powerful report and charting system based on Report Definition Language (RDL). Tabular, free form, matrix, charts are fully supported. Report output may be displayed as HTML, PDF, XML, .Net Control, Web Archive, and to a printer. Libraries exist for use … Read more
WCF Disable Deserialization Order Sensitivity
You can specify the serialization order by decorating the elements in your data contract: [DataContract] public class Foo { [DataMember(Order=1)] public int ID { get; set; } [DataMember(Order=2)] public int Bar { get; set; } } So you can make sure the serialization order is the same all the time. But there is no way … Read more
How does Windows differentiate between a regular EXE and a .NET exe?
I think that the following two links are a good resource to get an understanding the PE file structure and the Windows loader. An In-Depth Look into the Win32 Portable Executable File Format (MSDN Mag Feb 2002) An In-Depth Look into the Win32 Portable Executable File Format, Part 2 (MSDN Mag Mar 2002) The exact … Read more