Joh*_*ohn 1 .net c# reflection
我在哪里可以找到转换方法,如
public static implicit operator MyType(OtherType d)
public static implicit operator OtherType(MyType d)
Run Code Online (Sandbox Code Playgroud)
在Type对象?
如果你问一个类型的方法,你会找到运算符.方法的IsSpecialName属性将返回true.例如:
using System;
public class Foo
{
public static implicit operator int(Foo input)
{
return 0;
}
}
class Test
{
static void Main(string[] args)
{
foreach (var method in typeof(Foo).GetMethods())
{
Console.WriteLine(method + ": " + method.IsSpecialName);
}
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
125 次 |
| 最近记录: |