scxv6server objserver

Aussieboy.

众所周知的成员
加入
9月7日,2020年
消息
53
编程经验
Beginner
嗨,我有一些我在文本文件中保存的福彩12选5走势图。我想重新使用它。
但是,我现在用这行收到错误 - his.interface.loadDataValue(1,192,DateTime.utcnow,Samplegs);

严重性福彩12选5走势图说明项目文件线抑制状态
错误CS1061“对象”不包含“loadDataValue”的定义,并且找不到可访问的扩展方法“loadDataValue”接受“类型对象”的第一个参数(您是否缺少使用指令或装配参考?)DNP3FT C: \ Users \ Administrator \ Source \ Repos \ dnp3ft \ dnp3ft \ program.cs 183活动

与.NET框架工作版本有关吗?

我有
C#:
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ScxV6DbClient;
using System.Diagnostics;


C#:
                scxv6server objserver = new ScxV6Server();
                objServer.Connect("Local", "admin", "admin");
                ScxV6Object obj = objServer.FindObject("xxx.xxx");
                ScxV6Aggregate His = obj.Aggregate["Historic"];

                for (int i = 1; i < 59; i++)
                {
                    //Write to history                           
                    His.Interface.LoadDataValue(1, 192, DateTime.UtcNow, sampleGS[i]);
                    obj = null;
                }

                objServer.Disconnect();
 

jmplhinney.

C#论坛主持人
工作人员
加入
2011年4月23日
消息
3,720
地点
悉尼,澳大利亚
编程经验
10+
That suggests that His.Interface is type object and that, if the underlying object is some other type and you want to use it as that type, you need to cast it as that type. If you mouse over it in the code window, what does Intellisense tell you?
 

jmplhinney.

C#论坛主持人
工作人员
加入
2011年4月23日
消息
3,720
地点
悉尼,澳大利亚
编程经验
10+

jmplhinney.

C#论坛主持人
工作人员
加入
2011年4月23日
消息
3,720
地点
悉尼,澳大利亚
编程经验
10+
这是该文档的文本版本:


Section 7.1.4, which describes that ScxV6Aggregate.Interface property, does indeed specify that it is type Object, confirming exactly what I said and what the error message indicated in the first place. With no prior experience with this library, I was able to confirm exactly what the issue was with a web search and a quick read of some documentation. Hopefully this illustrates the steps you should be taking on your own behalf before posting a question, reserving such posts for the stuff that you can't work out for yourself.
 

jmplhinney.

C#论坛主持人
工作人员
加入
2011年4月23日
消息
3,720
地点
悉尼,澳大利亚
编程经验
10+
FYI, the documentation includes example code that appears to be written in VB6. Lots of VB6 code relies on late binding, which means that the code refers to members that the compiler cannot confirm at compile time and thus are basically ignored and left until run time to be resolved. This is also possible in VB.NET if you set Option Strict Off but it is not supported in C#. That means that the C# code you posted could never have worked and must have just been a direct conversion from some VB code that you didn't analyse in order to understand properly in a C# context.
 
最佳 底部