Scenario: You place a collection of objects in a JCF collection for later use. You are working with a closed group of objects and wish to infer object equality by means of object identity.
Problem: The objects may implement equals and hashCode specifically and the JCF classes make heavy use of these internally. You wish to […]
Viridium.ro
c#
Object Identity and the Collection Framework
C# var - Good or Bad?
Years ago, someone on Undernet’s #java was telling us that his Java methods followed an old C pattern: variable declarations at the top, code to initialize and use the variables down below. (Surprisingly similar to the var debate, isn’t it?) Is it good, or bad? Well, if variable names are cryptic enough that you can’t […]
CruiseControl.NET, MSTest, NUnit: A Hybrid Solution
As many frustrated build admins know by now, Microsoft has done a poor job of distributing the proper build tools with the .NET Framework. MSBuild is in there now, but MS has failed to see the importance of including MSTest; either that, or the idea was lynched by their marketing department. This leaves us with […]
XmlSerializer Namespaces
If you worked with NHibernate mappings, you know very well about the namespace declarations on the root element: <hibernate-mapping xmlns=”urn:nhibernate-mapping-2.2″>. We generate these mappings programmatically, and we naturally wondered how to remove the default xmlns:xsd and xmlns:xsi declarations that the XmlSerializer adds, and add the NHibernate URN in the mix. The recipe below outlines the three necessary steps.
Step […]
.NET Extension Methods How-To
I had to learn the following simple steps for making an extensions method the hard way. You don’t have to.
Procedure
To write an extension method:
Create a static class.
Write a static method taking an object of the type being extended as first parameter.
Add method parameters.
Prepend the keyword this to this this parameter.
Make the class and its extension […]