I would like to define my own alias for complex type. I'm curious why the compiler does not recognize already imported types. For example:
Works:
using System;
using System.Collections.Generic;
using myCollection = System.Collections.Generic.L开发者_C百科ist
<System.Collections.Generic.Dictionary<string, string>>;
Error:
using System;
using System.Collections.Generic;
using myCollection = List<Dictionary<string, string>>;
Try this:
using System;
using System.Collections.Generic;
namespace ConsoleApplication1
{
using myCollection = List<Dictionary<string, string>>;
}
using
directives can't refer to types imported in the same scope. The above example works, because the last using
directive refers only to types imported in an outer scope.
精彩评论