Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/293.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何使用';新';使用codedom的方法签名中的关键字_C#_.net_Codedom - Fatal编程技术网

C# 如何使用';新';使用codedom的方法签名中的关键字

C# 如何使用';新';使用codedom的方法签名中的关键字,c#,.net,codedom,C#,.net,Codedom,我想使用codedom在方法签名中动态生成一个带有“new”关键字的方法。想要生成这样的东西吗 private new void MyMethod() { } 比如: CodeMemberMethod myMethodMethod = new CodeMemberMethod(); myMethodMethod.Attributes = MemberAttributes.Private | MemberAttributes.New; myMethodMethod.Name = "MyMet

我想使用codedom在方法签名中动态生成一个带有“new”关键字的方法。想要生成这样的东西吗

private new void MyMethod()
{ 

}
比如:

CodeMemberMethod myMethodMethod = new CodeMemberMethod();
myMethodMethod.Attributes = MemberAttributes.Private | MemberAttributes.New;
myMethodMethod.Name = "MyMethod";
它是一个
MemberAttributes
MemberAttributes。新的

调用时,只需包括:

指示该方法始终在vtable中获取新插槽


谢谢你,萨纳托斯。这就是我想要的。