本文整理汇总了C#中Address.SetAddressFields方法的典型用法代码示例。如果您正苦于以下问题:C# Address.SetAddressFields方法的具体用法?C# Address.SetAddressFields怎么用?C# Address.SetAddressFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Address
的用法示例。
在下文中一共展示了Address.SetAddressFields方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddressSetFieldsOnObject
public void AddressSetFieldsOnObject()
{
var a1 = new Address(typeof(PathAddressData), "a&b");
var pad = new PathAddressData();
a1.SetAddressFields(pad);
Assert.AreEqual("a&b", pad.P);
var a2 = new Address(typeof(SplitAddressData), "a&001");
var sad = new SplitAddressData();
a2.SetAddressFields(sad);
Assert.AreEqual("a", sad.A);
Assert.AreEqual(1, sad.B);
var a3 = new Address(typeof(SplitAddressData), "a");
var sad2 = new SplitAddressData();
sad2.B = 100;
a3.SetAddressFields(sad2);
Assert.AreEqual("a", sad2.A);
Assert.AreEqual(0, sad2.B);
var a4 = new Address();
a4.Type = typeof(SplitAddressData);
a4["_1"] = 2;
var sad3 = new SplitAddressData();
sad3.A = "hello";
a4.SetAddressFields(sad3);
Assert.IsNull(sad3.A);
Assert.AreEqual(sad3.B, 2);
}