Month

March 2022
dynamic x = new ExpandoObject(); x.NewProp = string.Empty; You may have seen the above but below is the good stuff var x = new ExpandoObject() as IDictionary<string, Object>; x.Add("NewProp", string.Empty); x.Add("Shout", new Action(() => { Console.WriteLine("Hellooo!!!"); })); x.Shout();
Read More
First test to see if the object is a castable class if that doesn’t work for basic types int string etc then you will use Convert.ChangeType.. if (readData is T) { return (T)readData; } try { return (T)Convert.ChangeType(readData, typeof(T)); } catch (InvalidCastException) { return default(T); }
Read More