我将SNMP oid值获取为字符串变量。电池剩余时间是电池剩余时间。但变量值如" 0d 2h 22m"但我想要它只有一分钟。当我调试程序时,我可以在方法code debug image中看到我想要的值 这是我的代码
string host = "ipaddress";
string community = "private";
string[] requestOid;
Dictionary<Oid,AsnType> result;
requestOid = new string[] { ".1.3.6.1.4.1.318.1.1.1.2.2.3.0" };
SimpleSnmp snmp = new SimpleSnmp(host,community);
result = snmp.Get(SnmpVersion.Ver2, requestOid);
string res = result.Values.ToString();
foreach (KeyValuePair<Oid, AsnType> kvp in result)
{
MessageBox.Show(kvp.Value.ToString());
}