Are implicit operators and TypeConverters equivalent?

前端 未结 4 2512
傲寒
傲寒 2021-02-20 09:57

It seems to me its very easy to implement an implicit operator versus a TypeConverter, so I\'m assuming they aren\'t equivalent because of the prevalence of TypeConverters in th

4条回答
  •  礼貌的吻别
    2021-02-20 10:50

    Implicit operators are nice but also they can be confusing. I think that when you need to convert from one type to another it best to be explicit as there is no question as to what is going on.

    Also implicit operators seemed to be reserved for things that are very much alike and the implicit conversion is intuitive. But I guess that is all subjective anyhow, use your best judgement.

提交回复
热议问题