在下面的代码示例调用l.Add(s)和c.Add(s)成功,但对于一般的,当它失败IList<string>.
var l = new List<string>();
dynamic s = "s";
l.Add(s);
var c = (ICollection<string>)l;
c.Add(s);
var i = (IList<string>)l;
i.Add("s"); // works
i.Add(s); // fails
Run Code Online (Sandbox Code Playgroud)
https://dotnetfiddle.net/Xll2If
未处理的异常:Microsoft.CSharp.RuntimeBinder.RuntimeBinderException:方法'Add'的重载在System.Dynamic.Uynamic.UpdateDelegates.UpdateAndExecuteVoid2 [T0,T1]的CallSite.Target(Closure,CallSite,IList`1,Object)中取'1'参数](CallSite网站,T0 arg0,T1 arg1)位于C:\ Dev\PlayGround\PlayGround\Program.cs中的Program.Main():第13行
IList<T>来源于ICollection<T>.有人可以解释为什么呼叫IList.Add失败?
在CakePhp <3中,可以使用调试视图获取已执行查询的列表
echo $this->element('sql_dump');
Run Code Online (Sandbox Code Playgroud)
在Cake 3中,相应的元素文件不再是核心.是否有蛋糕3相当于?我在迁移指南中找不到任何相关内容.