Is there a way to define C# strongly-typed aliases of existing primitive types like `string` or `int`?

前端 未结 7 1230
忘掉有多难
忘掉有多难 2021-02-18 18:52

Perhaps I am demonstrating my ignorance of some oft-used feautre of C# or the .NET framework, but I would like to know if there is a natively-supported way to create a type alia

7条回答
  •  北恋
    北恋 (楼主)
    2021-02-18 19:18

    Does the System.Net.Mail.MailAddress class fit your needs, or at least "help"?

    EDIT: It's not explicitly IEquatable or ISerializable, but you could easily enough add those in your own wrapper.

提交回复
热议问题