(对象)是一个字段,但像'方法'一样使用

时间:2013-05-15 15:37:13

标签: c# object methods get field

运行此代码时出现错误:

错误1'EPSInvoice_ServiceLibrary.EPS_Service.tr_bl'是'字段',但用作'方法'

它在VS.net中运行良好,但我正在转换为C#。 任何帮助,将不胜感激。 感谢

以下是代码:

public class EPS_Service : IEPS_Service
    {
        List<input_params> Users = new List<input_params>();
        List<token_data> token_data = new List<token_data>(); 
        public decimal cal;
        object tr_bl;
        string branch;


        public void User_Login(input_params inputparams)
        { 
            EPS30Ora.EPS30Svr svr = new EPS30Ora.EPS30Svr();

              if (svr.LogOnEx("EDEESTE", inputparams.VSID, inputparams.Username, inputparams.Password, "EPS30Ora", ref inputparams.ck) == 0)
              {
                  try
                  {
                      Users.Add(inputparams);
                      svr.PrepareByMoney(inputparams.ck, 1, inputparams.meter_number, 10, 0, ref cal);
                      tr_bl = svr.GetInvoiceData(inputparams.ck, svr.Confirm(inputparams.ck));
                      branch = tr_bl(0)(1); 
                      token_data.Add(new token_data() { transfer_number = "0000000" });
                  }
                  catch (System.Runtime.InteropServices.COMException ex)
                  {

                  }
              }
        }

1 个答案:

答案 0 :(得分:3)

您的数组索引器需要是方括号:

branch = tr_bl[0][1];