C# 本地类型别名

问题描述 投票:0回答:0

在 C# 中真的没有办法缩短冗长的代码吗?

Dictionary<my.very.long.type, my.other.long.type> myVar; //code that repetitevely uses those classes
用类似的东西

using acronym = my.very.long.type { using acronym2 = my.other.long.type { Dictionary<acronym , my.other.long.type> myVar; //code that repetitively uses those classes } }
不使用文件范围别名? (使用文件开头的语句)

对于冗长的语言来说,这似乎是一个必须具备的功能,

它将大大提高重点必须放在操作顺序而不是类型上的部分的可读性。

我的搜索只找到“否”作为答案,但我拒绝相信它。

c# alias
© www.soinside.com 2019 - 2024. All rights reserved.