本文整理汇总了C#中ESRI.get_Name方法的典型用法代码示例。如果您正苦于以下问题:C# ESRI.get_Name方法的具体用法?C# ESRI.get_Name怎么用?C# ESRI.get_Name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ESRI
的用法示例。
在下文中一共展示了ESRI.get_Name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDomainValueForName
/// <summary>
/// Finds the actual value of a given name of a coded value domain
/// </summary>
/// <param name="domain">CodedValueDomain to check</param>
/// <param name="name">Name of the desired value</param>
/// <returns>The value</returns>
public static object GetDomainValueForName(ESRI.ArcGIS.Geodatabase.ICodedValueDomain domain, string name)
{
object result = null;
if (null == domain)
{
throw new ArgumentNullException("domain");
}
for (int i = 0; i < domain.CodeCount; i++)
{
string testName = domain.get_Name(i);
if (0 == string.Compare(name, testName))
{
result = domain.get_Value(i);
break;
}
}
if (null == result)
{
throw new Exception(string.Format("name {0} not found in the domain {1}", name, ((ESRI.ArcGIS.Geodatabase.IDomain)domain).Name));
}
return result;
}
示例2: GetDomainNameForValue
/// <summary>
/// Finds the display name for a given value in a coded value domain
/// </summary>
/// <param name="domain">CodedValueDomain to check</param>
/// <param name="value">The value</param>
/// <returns>The name, or string.Empty if not found</returns>
public static string GetDomainNameForValue(ESRI.ArcGIS.Geodatabase.ICodedValueDomain domain, object value)
{
string result = string.Empty;
if (null == domain)
{
throw new ArgumentNullException("domain");
}
for (int i = 0; i < domain.CodeCount; i++)
{
object testValue = domain.get_Value(i);
if (testValue.Equals(value))
{
result = domain.get_Name(i);
break;
}
}
if (null == result)
{
throw new Exception(string.Format("value {0} not found in the domain {1}", value, ((ESRI.ArcGIS.Geodatabase.IDomain)domain).Name));
}
return result;
}