Why can't i use partly qualified namespaces during object initialization?

前端 未结 4 1790
不知归路
不知归路 2020-12-28 20:59

I suspect this is a question which has been asked many times before but i haven\'t found one.

I normally use fully qualified namespaces if i don\'t use that type of

4条回答
  •  攒了一身酷
    2020-12-28 21:24

    The documentation says:

    Create a using directive to use the types in a namespace without having to specify the namespace. A using directive does not give you access to any namespaces that are nested in the namespace you specify.

    So the using only includes the types (not the namespaces) that are defined in the specified namespace. In order to access types of nested namespace you need to specify it explicitly with a using directive as you did in your first example.

提交回复
热议问题