public void TestDemo4TryGetMember() { dynamic myDynamicObject = new TimsDynamicObject { SomeProperty = "Get DynamicObject Demo" }; Assert.AreEqual("Get DynamicObject Demo", myDynamicObject.Title); }
public void TestDemo4DynamicvsDynamicObject() { //"dynamic" allows me to write anything after the "." dynamic mystring = ""; //mystring.SomeProperty = "42"; //mystring.Title = "42"; //DynamicObject can call "real properties" like a "normal object" TimsDynamicObject dynamicObject = new TimsDynamicObject(); dynamicObject.SomeProperty = "42"; //dynamicObject.Title = "42"; //Combine the two to get both features dynamic fullDynamicObject = new TimsDynamicObject(); fullDynamicObject.SomeProperty = "42"; fullDynamicObject.Title = "42"; }
public void TestDemo4TrySetMember() { dynamic myDynamicObject = new TimsDynamicObject(); myDynamicObject.Title = "Set DynamicObject Demo"; Assert.AreEqual("Set DynamicObject Demo", myDynamicObject.SomeProperty); }