本文整理汇总了C#中ApplicationData.UpdateFrom方法的典型用法代码示例。如果您正苦于以下问题:C# ApplicationData.UpdateFrom方法的具体用法?C# ApplicationData.UpdateFrom怎么用?C# ApplicationData.UpdateFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApplicationData
的用法示例。
在下文中一共展示了ApplicationData.UpdateFrom方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UnknownRepeater
public void UnknownRepeater()
{
ApplicationData target = new ApplicationData();
Dictionary<string, object>[] repeater = new Dictionary<string, object>[2];
repeater[0] = new Dictionary<string, object>();
repeater[1] = new Dictionary<string, object>();
target["repeater1"] = repeater;
repeater[0]["field1"] = "leave me alone!";
repeater[0]["field2"] = "leave me alone too!";
repeater[1]["field1"] = "leave me alone!";
repeater[1]["field2"] = "i'm incorrect anyway - update me!";
ApplicationData source = new ApplicationData();
Dictionary<string, object>[] sourceRepeater = new Dictionary<string, object>[2];
sourceRepeater[0] = new Dictionary<string, object>();
sourceRepeater[1] = new Dictionary<string, object>();
source["repeater1"] = sourceRepeater;
sourceRepeater[1]["field2"] = "you've been overwritten!";
sourceRepeater[1]["field3"] = "I am the unknown control!";
target.UpdateFrom(source);
Assert.IsNull(target.GetValue<string>("repeater1[1].field3"));
}
示例2: Unknown
public void Unknown()
{
ApplicationData target = new ApplicationData();
target["field1"] = "leave me alone!";
ApplicationData source = new ApplicationData();
source["field2"] = "you've been overwritten!";
source["field3"] = "I am the unknown control!";
target.UpdateFrom(source);
Assert.IsFalse(target.ContainsKey("field3"));
}
示例3: Retain
public void Retain()
{
ApplicationData target = new ApplicationData();
target["field1"] = "leave me alone!";
ApplicationData source = new ApplicationData();
source["field2"] = "you've been overwritten!";
target.UpdateFrom(source);
Assert.AreEqual("leave me alone!", target["field1"]);
}
示例4: RetainRepeater
public void RetainRepeater()
{
ApplicationData target = new ApplicationData();
Dictionary<string, object>[] repeater = new Dictionary<string, object>[2];
repeater[0] = new Dictionary<string, object>();
repeater[1] = new Dictionary<string, object>();
target["repeater1"] = repeater;
repeater[0]["field1"] = "leave me alone!";
repeater[0]["field2"] = "leave me alone too!";
repeater[1]["field1"] = "leave me alone!";
repeater[1]["field2"] = "i'm incorrect anyway - update me!";
ApplicationData source = new ApplicationData();
Dictionary<string, object>[] sourceRepeater = new Dictionary<string, object>[2];
sourceRepeater[0] = new Dictionary<string, object>();
sourceRepeater[1] = new Dictionary<string, object>();
source["repeater1"] = sourceRepeater;
sourceRepeater[1]["field2"] = "you've been overwritten!";
target.UpdateFrom(source);
Assert.AreEqual("leave me alone too!", target.GetValue<string>("repeater1[0].field2"));
}
示例5: Overwrite
public void Overwrite()
{
ApplicationData target = new ApplicationData();
target["field1"] = "leave me alone!";
target["field2"] = "i'm incorrect anyway - update me!";
ApplicationData source = new ApplicationData();
source["field2"] = "you've been overwritten!";
target.UpdateFrom(source);
Assert.AreEqual("you've been overwritten!", target["field2"]);
}