本文整理汇总了C#中Match.IsPropertyMatch方法的典型用法代码示例。如果您正苦于以下问题:C# Match.IsPropertyMatch方法的具体用法?C# Match.IsPropertyMatch怎么用?C# Match.IsPropertyMatch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Match
的用法示例。
在下文中一共展示了Match.IsPropertyMatch方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestMatchObject
public void TestMatchObject() {
var o = new Match() as object;
Assert.IsTrue(o.IsPropertyMatch<Match, string>("Prop1", mm => mm.Prop1));
Assert.IsTrue(o.IsPropertyMatch<Match, int>("Prop2", mm => mm.Prop2));
Assert.IsTrue(o.IsPropertyMatch<Match, Match>("Prop3", mm => mm.Prop3));
Assert.IsTrue(o.IsPropertyMatch<Match, int?>("Prop4", mm => mm.Prop4));
Assert.IsFalse(o.IsPropertyMatch<Match, string>("Prop2", mm => mm.Prop1));
Assert.IsFalse(o.IsPropertyMatch<Match, int>("Something", mm => mm.Prop2));
Assert.IsFalse(o.IsPropertyMatch<Match, int>("", mm => mm.Prop2));
Assert.IsFalse(o.IsPropertyMatch<Match, int>(null, mm => mm.Prop2));
var oo = new Object();
Assert.IsFalse(oo.IsPropertyMatch<Match, string>("Prop1", mm => mm.Prop1));
Assert.IsFalse(oo.IsPropertyMatch<Match, int>("Prop2", mm => mm.Prop2));
Assert.IsFalse(oo.IsPropertyMatch<Match, Match>("Prop3", mm => mm.Prop3));
Assert.IsFalse(oo.IsPropertyMatch<Match, int?>("Prop4", mm => mm.Prop4));
Assert.IsFalse(oo.IsPropertyMatch<Match, string>("Prop2", mm => mm.Prop1));
Assert.IsFalse(oo.IsPropertyMatch<Match, int>("Something", mm => mm.Prop2));
Assert.IsFalse(oo.IsPropertyMatch<Match, int>("", mm => mm.Prop2));
Assert.IsFalse(oo.IsPropertyMatch<Match, int>(null, mm => mm.Prop2));
}
示例2: TestMatch
public void TestMatch() {
var m = new Match();
Assert.IsTrue(m.IsPropertyMatch("Prop1", mm => mm.Prop1));
Assert.IsTrue(m.IsPropertyMatch("Prop2", mm => mm.Prop2));
Assert.IsTrue(m.IsPropertyMatch("Prop3", mm => mm.Prop3));
Assert.IsTrue(m.IsPropertyMatch("Prop4", mm => mm.Prop4));
Assert.IsFalse(m.IsPropertyMatch("Prop2", mm => mm.Prop1));
Assert.IsFalse(m.IsPropertyMatch("Something", mm => mm.Prop2));
Assert.IsFalse(m.IsPropertyMatch("", mm => mm.Prop2));
Assert.IsFalse(m.IsPropertyMatch(null, mm => mm.Prop2));
}