using System.Collections.Generic; using System.Text; namespace Lextm.SharpSnmpLib.Mib { public class ObjectIdentifier: List> { public void Add(string name, uint oid) { this.Add(new KeyValuePair(name, oid)); } public void Prepend(string name, uint oid) { this.Insert(0, new KeyValuePair(name, oid)); } public void Insert(int index, string name, uint oid) { this.Insert(index, new KeyValuePair(name, oid)); } public string GetOidString() { StringBuilder result = new StringBuilder(); foreach (KeyValuePair level in this) { result.Append(level.Value); result.Append('.'); } if (result.Length > 0) { result.Length--; } return result.ToString(); } public uint[] GetOidValues() { List result = new List(); foreach (KeyValuePair level in this) { result.Add(level.Value); } return result.ToArray(); } } }