Make Encapsulation Easy with dotNetTips.Utility

Encapsulation is the first pillar of Object Oriented Programming (OOP), yet most code that I see does not implement encapsulation correctly or not all. Like I say in many of my conference sessions "If you do not implement encapsulation, you aren't doing OOP!" I also say "Bad data in, bad data out!". Several years ago, [...]

Advertisements

Using Generic Constraints & Default

Here is a great video from one of my buddies, Jeremy Clark, on generic constraints and default: Here is an extension method I made from Jeremy's second example: public static T Max<T>(this T obj1, T obj2) where T : IComparable {     if obj1.CompareTo(obj2) >= 0 ? return obj1 : return obj2; }