我有一个匿名课程:
var someAnonymousClass = new
{
SomeInt = 25,
SomeString = "Hello anonymous Classes!",
SomeDate = DateTime.Now
};
Run Code Online (Sandbox Code Playgroud)
无论如何将属性附加到此类?反思,其他?我真的希望这样的事情:
var someAnonymousClass = new
{
[MyAttribute()]
SomeInt = 25,
SomeString = "Hello anonymous Classes!",
SomeDate = DateTime.Now
};
Run Code Online (Sandbox Code Playgroud) 如何将MarshalAsAttribute应用于下面代码的返回类型?
public ISomething Foo()
{
return new MyFoo();
}
Run Code Online (Sandbox Code Playgroud)