本文整理汇总了C#中ObjectIdentifier.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectIdentifier.ToString方法的具体用法?C# ObjectIdentifier.ToString怎么用?C# ObjectIdentifier.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectIdentifier
的用法示例。
在下文中一共展示了ObjectIdentifier.ToString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MatchGet
public override ScalarObject MatchGet(ObjectIdentifier id)
{
ScalarObject result = base.MatchGet(id);
if (result == null && id.ToString().Contains(SNMPHelper.TestTreePath))
{
logger.InfoFormat("Create OID id: {0}", id);
IOidUnit oidUnit = CreateOidUnit(id);
oidUnit.ValueChanged +=
(sender, args) => { if (TestValueChanged != null) TestValueChanged.Invoke(sender, args); };
result = (ScalarObject) oidUnit;
_elements.Add(result);
}
return result;
}
示例2: CreateOidUnit
protected IOidUnit CreateOidUnit(ObjectIdentifier id)
{
var oidUnit = new OidUnit(id.ToString(), new OctetString("NULL"));
return oidUnit;
}
示例3: TestConversion
public void TestConversion()
{
var o = new ObjectIdentifier(".1.3.6.1.2.1.1.1.0");
Assert.AreEqual(".1.3.6.1.2.1.1.1.0", o.ToString());
}
示例4: GetStringOf
public static string GetStringOf(ObjectIdentifier id, IObjectRegistry objects)
{
if (id == null)
{
throw new ArgumentNullException("id");
}
if (objects == null)
{
return id.ToString();
}
string result = objects.Tree.Search(id.ToNumerical()).AlternativeText;
return string.IsNullOrEmpty(result) ? id.ToString() : result;
}
示例5: TestToString
public void TestToString()
{
var transmission = new ObjectIdentifier(new uint[] {1, 3, 6, 1, 2, 1, 10});
//Assert.AreEqual(".iso.org.dod.internet.mgmt.mib-2.transmission",
// transmission.ToString(DefaultObjectRegistry.Instance));
Assert.AreEqual(".1.3.6.1.2.1.10", transmission.ToString());
}
示例6: GetObjectIndex
public static int GetObjectIndex(ObjectIdentifier id)
{
string[] dots = id.ToString().Split('.');
return Convert.ToInt32(dots.Last());
}