1
我想爲複雜類型定義自己的別名。我很好奇爲什麼編譯器不能識別已經導入的類型。例如:在「使用」中使用別名
作品:
using System;
using System.Collections.Generic;
using myCollection = System.Collections.Generic.List
<System.Collections.Generic.Dictionary<string, string>>;
錯誤:
using System;
using System.Collections.Generic;
using myCollection = List<Dictionary<string, string>>;
C#中沒有typedef! – 2010-09-13 19:28:13
@ClausJørgensen:與'using'混淆非常接近。你只需要在每個文件中重複它,因爲沒有'#include'。 – dtb 2010-09-13 19:30:48
是的,但他明確要求的是typedef,而不是命名空間的縮寫。差別很大,即使是C++開發人員也傾向於濫用typedef來實現它的目的。 – 2010-09-13 20:44:06