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

前端 未结 7 1211
忘掉有多难
忘掉有多难 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:23

    I think you want to use extension methods. They allow you to extend a classes functionality without creating a new derived type.

提交回复
热议问题