C#: How to create “aliases” for classes

前端 未结 7 1658
你的背包
你的背包 2020-12-17 18:43

I don\'t even know if it\'s called an alias, but let me continue anyway.

You know how the System.String type in C# is sorta \"aliased\" with \"string\"? In Visual S

7条回答
  •  感动是毒
    2020-12-17 19:34

    Use a using directive

    using Rppr = Namespace.To.RelocatedPlantProductReleaseItem;
    

    EDIT Op clarified to ask for a global solution.

    There is no typedef style equivalent in C# which can create a global replacement of a type name. You'll need to use a using directive in every file you want to have this abbreviation or go for the long version of the name.

提交回复
热议问题