> public static class ExtensionMethods > { > //______________________________________________________________________ > public static T GetNonNull<T>(this T? value) where T : struct > { > return value == null ? default(T) : (T)value; > } > //______________________________________________________________________ > public static string GetNonNull(this string value) > { > return value == null ? "" : value; > } > //______________________________________________________________________ > } > > >// test >public class test2 > { > > > //______________________________________________________________________ > public static void Main( string[] args ) > { > int? i = null; > bool? b = null; > string x = null; > DateTime? dt = null; > > Console.WriteLine("i: {0}", i.GetNonNull()); > Console.WriteLine("b: {0}", b.GetNonNull()); > Console.WriteLine("x: {0}", x.GetNonNull()); > Console.WriteLine("dt: {0}", dt.GetNonNull()); > > Console.ReadLine(); > } > } > >Ok, I created a static class called ExtensionMethods in my MiscFunctions solution. I referenced it in this project and added the using statement. When I type this:
_ProjectName = ds.Tables[0].Rows[0]["ProjectName"].ToString();I don't see GetNonNull in intellisense.