Namespaces and subnamespaces in C#

前端 未结 8 993
鱼传尺愫
鱼传尺愫 2021-01-19 07:23

begginers question about C#.

In every program I have to include several namespaces, like:

using System;
using System.Collections.Generic;
using Syste         


        
相关标签:
8条回答
  • 2021-01-19 07:42

    If you wanted access to a class in System.Text without the using statement, you would have to Text."Name of class/function" every time you wished to use it.

    This way you can just call "name of class/function".

    Not sure if you are a beginner, but that's the simplest way I can describe put it.

    0 讨论(0)
  • 2021-01-19 07:55

    Just an added example to make you understand clearly.

    A child Namespace cant be accessed by calling parent namespaces

    Namespace Main  //only code and classes are accessible
    {
      //code for Main Namespace
      Namespace subMain     //only code and classes are accessible
      {
         //code for subMain
         Namespace verySubMain  //only code and classes are accessible
         {
            //code for verySubMain
         }
         Namespace otherVerySubMain  //only code and classes are accessible
         {
            //code for otherVerySubMain
         }
      }
    }
    
    0 讨论(0)
提交回复
热议问题