Mega Code Archive

 
Categories / C# Tutorial / Data Type
 

Reference Compare for nullable value

public static class PartialComparer     {         public static int? ReferenceCompare<T>(T first, T second) where T : class{             if (first == second){                 return 0;             }             if (first == null){                 return -1;             }             if (second == null){                 return 1;             }             return null;         }     }