Tag Archives: Snippet

How to check for duplicates

Say you have an IEnumerable<T> of some sort and you want to check if it contains any duplicates. How do you do that? Terrible solution I needed to do this a while ago and the first solution that hit me wasn’t exactly good. Linq has method called Distinct, which returns the distinct items in a sequence (weeds [...]
Posted in Software Development | Also tagged , , | Leave a comment

Generics and checking for null

When writing C#, in Visual Studio, using generics… have you ever tried checking for null? I have always found that a bit of a hassle. Say we have this method which returns the subject if it is not null, and the result of a createNew() function if it is null. public static T NewIfNull<t>(this T subject, [...]
Posted in Software Development | Also tagged , | Leave a comment
  • Twitter Facebook YouTube last.fm LinkedIn Google vimeo Technorati RSS feed
  • This would be meGreetings! I am Torleif Berger, 24 years old, a Seventh-Day Adventist and currently working as a software developer. Otherwise, not much to tell. Although I do juggle a bit...