本文整理汇总了C#中System.Dynamic.ExpandoObject.Method方法的典型用法代码示例。如果您正苦于以下问题:C# ExpandoObject.Method方法的具体用法?C# ExpandoObject.Method怎么用?C# ExpandoObject.Method使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Dynamic.ExpandoObject
的用法示例。
在下文中一共展示了ExpandoObject.Method方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
XElement racers = XElement.Load("http://www.cninnovation.com/downloads/Racers.xml");
var q = from r in racers.Elements("Racer")
where r.Element("Country").Value == "Brazil" && int.Parse(r.Element("Wins").Value) > 18
select new
{
Name = r.Element("Firstname").Value + " " + r.Element("Lastname").Value,
Country = r.Element("Country").Value
};
foreach (var r in q)
{
Console.WriteLine($"{r.Name}, {r.Country}");
}
int x = 3;
Foo(b: x, a: x);
XNamespace ns = "www.xy.z";
var books = new XElement(ns + "Books",
new XElement("Book", new XAttribute("Title", "Professional C# 6"),
new XAttribute("Publisher", "Wrox Press"),
new XElement("Content", "Pages")));
Console.WriteLine(books);
dynamic exp1 = new ExpandoObject();
exp1.FirstName = "Tom";
exp1.LastName = "Turbo";
exp1.Method = new Func<string>(() => "abc");
Console.WriteLine(exp1.FirstName);
string abc = exp1.Method();
//dynamic p = new Program();
//dynamic x2 = p.CoolBar();
//Console.WriteLine(x2);
}
示例2: dynamicMethodInvoke_ManyArguments
public void dynamicMethodInvoke_ManyArguments()
{
dynamic d = new ExpandoObject();
dynamic foo = d.Method(1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 5, 6, 7, 8, 9);
}
示例3: dynamicMethodInvoke_AFewArguments
public void dynamicMethodInvoke_AFewArguments()
{
dynamic d = new ExpandoObject();
dynamic foo = d.Method(1, 2);
}