本文整理汇总了C#中System.Dynamic.ExpandoObject.Increment方法的典型用法代码示例。如果您正苦于以下问题:C# ExpandoObject.Increment方法的具体用法?C# ExpandoObject.Increment怎么用?C# ExpandoObject.Increment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Dynamic.ExpandoObject
的用法示例。
在下文中一共展示了ExpandoObject.Increment方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExpandoDemo
public static void ExpandoDemo()
{
dynamic ex = new ExpandoObject();
ex.Name = "Keith";
ex.Age = "pi";
Console.WriteLine(new { ex.Name, ex.Age, ex.ShirtColor });
ex.Increment = new Func<int, int>(i => i + 1);
Console.WriteLine("1 + 1 = {0}", ex.Increment(1));
}
示例2: ExpandoObjectDemo
public void ExpandoObjectDemo()
{
dynamic dyn = new ExpandoObject();
dyn.number = 1;
dyn.Increment = new Action(() => { dyn.number++; });
Console.WriteLine(dyn.number);
dyn.Increment();
Console.WriteLine(dyn.number);
foreach (var propery in (IDictionary<string, object>)dyn)
{
Console.WriteLine(propery.Key+":"+propery.Value);
}
((INotifyPropertyChanged)dyn).PropertyChanged += DynamicDemo_PropertyChanged;
dyn.name = "changed";
dyn.name = "another";
}
示例3: Expando
public static void Expando()
{
dynamic ex = new ExpandoObject();
ex.Name = "Keith";
Console.WriteLine(ex.Name);
ex.Increment = new Func<int, int>(i => i + 1);
Console.WriteLine("1 + 1 = {0}", ex.Increment(1));
}