本文整理汇总了C#中QualifiedName.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# QualifiedName.ToString方法的具体用法?C# QualifiedName.ToString怎么用?C# QualifiedName.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QualifiedName
的用法示例。
在下文中一共展示了QualifiedName.ToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetQualifiedAreaName
/// <summary>
/// Provides a mechanism to assemble a fully qualified Area name in a hierarchical space.
/// </summary>
/// <param name="szAreaName">The name of an Area at the current level, obtained from the string enumerator returned by BrowseOPCAreas with a BrowseFilterType of OPC_AREA</param>
/// <param name="pszQualifiedAreaName">Where to return the resulting fully qualified area name.</param>
public void GetQualifiedAreaName(string szAreaName, out string pszQualifiedAreaName)
{
pszQualifiedAreaName = String.Empty;
try
{
pszQualifiedAreaName = szAreaName;
// Make sure the stack is not null
INode parent = m_browseStack.Peek();
if (parent == null)
{
throw ComUtils.CreateComException(ResultIds.E_FAIL);
}
// And make sure this is avalid Area name at the level
INode child = FindChildByName(parent.NodeId, szAreaName);
if (child == null)
{
throw ComUtils.CreateComException(ResultIds.E_INVALIDARG);
}
pszQualifiedAreaName = "";
INode[] stack = m_browseStack.ToArray();
for (int i = stack.Length - 2; i >= 0; i--)
{
// Translate the server namespace index in browsename to the corresponding client namespace index
QualifiedName QName = stack[i].BrowseName;
QualifiedName translatedName = new QualifiedName(QName.Name, (ushort)m_server.ServerMappingTable[QName.NamespaceIndex]);
if (pszQualifiedAreaName.Length != 0)
pszQualifiedAreaName = pszQualifiedAreaName + "/" + translatedName.ToString();
else
pszQualifiedAreaName = translatedName.ToString();
}
//Also translate the areaname
QualifiedName QualifiedAreaName = QualifiedName.Parse(szAreaName);
QualifiedName TranslatedAreaName = new QualifiedName(QualifiedAreaName.Name, (ushort)m_server.ServerMappingTable[QualifiedAreaName.NamespaceIndex]);
pszQualifiedAreaName = pszQualifiedAreaName + "/" + TranslatedAreaName.ToString();
}
catch (COMException e)
{
throw ComUtils.CreateComException(e);
}
catch (Exception e)
{
Utils.Trace(e, "Unexpected error in GetQualifiedAreaName");
throw ComUtils.CreateComException(e);
}
}
示例2: GetMetadataString
private string GetMetadataString(string componentType,
ComponentName componentName,
QualifiedName property)
{
return GetComponentMetadata(componentType, componentName)
.GetString(property.ToString());
}