Is there a way to do dynamic implicit type casting in C#?

后端 未结 3 1980
栀梦
栀梦 2020-12-06 05:57

Given this class with an implicit cast operator:

public class MyDateTime
{
    public static implicit operator MyDateTime(System.Int64 encoded)
    {
                


        
3条回答
  •  南笙
    南笙 (楼主)
    2020-12-06 06:31

    Adding an explicit operator should work: http://msdn.microsoft.com/en-us/library/85w54y0a(VS.80).aspx

提交回复
热议问题