Tag: dynamicdynamic

dynamic不包含项目引用的属性的定义

我收到一个错误,说: 'object'不包含'Title'的定义 所有的代码也在github上 我有一个ConsoleApplication1,看起来像这样 namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Movie m = new Movie(); var o = new { Title = "Ghostbusters", Rating = "PG" }; Console.WriteLine(m.PrintMovie(o)); } } } 和Movie.cs public class Movie : DynamicObject { public string PrintMovie(dynamic o) { return string.Format("Title={0} Rating={1}", o.Title, o.Rating); } } […]