IList<bd_Invcl> ilist = new bd_invcl_Service().getAllinvcl();
其中:bd_invcl_Service类中public IList<bd_Invcl> getAllinvcl() 但如果按以下分成两行写法则报错
    bd_invcl_service bdinvcl = new bd_invcl_service();
    IList<bd_Invcl> ilist = bdinvcl.getAllinvcl();错误信息如下:
错误 1 字段初始值设定项无法引用非静态字段、方法或属性“BLL.invclManger.bdinvcl。。” 请问为什么一行写没问题,分成两行就有问题呢?谢谢!

解决方案 »

  1.   

    应该不是因为分开写的原因吧...bd_invcl_servicebd_invcl_Service
      

  2.   

            bd_invcl_service bdinvcl = new bd_invcl_service();
            IList<bd_Invcl> lista = bdinvcl.getAllinvcl();
    不是大小写的问题;
    我不清楚为什么会报错;写成一行就不会报错了;
             IList<bd_Invcl> lista = new bd_invcl_service().getAllinvcl(); 为什么呢?谢谢啦!!
      

  3.   

    IList<bd_Invcl> ilist = new bd_invcl_Service().getAllinvcl();  bd_invcl_service bdinvcl = new bd_invcl_Service(); <----
      IList<bd_Invcl> ilist = bdinvcl.getAllinvcl();c# 大小写敏感 兄弟
      

  4.   

    上面写错了 bd_invcl_Service bdinvcl = new bd_invcl_Service(); <----
      IList<bd_Invcl> ilist = bdinvcl.getAllinvcl();
      

  5.   

    错误代码:第一粘的是我写错了,改正后还是老样子:bd_invcl_service bdinvcl = new bd_invcl_service();//此处均大写S,我前后类名是粘的,
    IList<bd_Invcl> lista = bdinvcl.getAllinvcl();也就是说我没有大小写问题,类名NEW前后均是粘过来的,还是报错,一行就不报错,为什么呢?