【C#】クソ長いクラス名を短くしたい
ブログ書くときにクラス名が長いと折り返されることがあります。
短くするためにエイリアスを使うといいかもしれません。*1
まあ逆に分かりづらくなるかもですが。
以下のコードではSortedictionary
using D = System.Collections.Generic.SortedDictionary<int, string>; namespace Sample { class Program { static void Main(string[] args) { D dic = new D(); dic.Add(1, "a"); } } }
名前空間、列挙体、構造体なんかでもOKです。
using G = System.Collections.Generic; using S = System.Environment.SpecialFolder; using E = System.Collections.Generic.Dictionary<int, string>.Enumerator;
*1:こういう使い方するもんじゃないっぽいですが。参考:名前空間 - C# によるプログラミング入門 | ++C++; // 未確認飛行 C