对于如下所示的代码
using System;
public class Test
{
public static void Main()
{
Test t = new Test();
object AnonymousInside= t.GetAnonymousType();
Console.Write(AnonymousInside.Key);//Error on compilation
}
public object GetAnonymousType()
{
return new {Key="KeyName",Value="ValueName"};
}
}
如何从 type 中取回匿名类型object
?
如果这是不可能的,那么这段代码是如何工作的?
@Html.TextBoxFor(model => model.ConfirmPassword, new { maxlength = 35, type = "password", @class="textArea margindrop",placeholder="Confirm password"})
其文档