'namespace' but is used like a 'type'

前端 未结 7 1661
孤独总比滥情好
孤独总比滥情好 2020-11-27 04:35

This is my program the class uses it is called Time2 I have the reference added to TimeTest I keep getting the Error \'Time2\' is a \'namespace\' but is used like a \'type\'

7条回答
  •  余生分开走
    2020-11-27 05:18

    If you're working on a big app and can't change any names, you can type a . to select the type you want from the namespace:

    namespace Company.Core.Context{
      public partial class Context : Database Context {
        ...
      }
    }
    ...
    
    using Company.Core.Context;
    someFunction(){
     var c = new Context.Context();
    }
    

提交回复
热议问题