本文整理汇总了C#中Enumeration.SetAttributeValue方法的典型用法代码示例。如果您正苦于以下问题:C# Enumeration.SetAttributeValue方法的具体用法?C# Enumeration.SetAttributeValue怎么用?C# Enumeration.SetAttributeValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Enumeration
的用法示例。
在下文中一共展示了Enumeration.SetAttributeValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindOrCreateFilterFunctionsEnumeration
private Enumeration FindOrCreateFilterFunctionsEnumeration()
{
foreach (var enumeration in Project.Enumerations)
{
if (enumeration.GetAttributeValue("isFilterFunctionsEnumeration", NamespaceUri, false))
{
return enumeration;
}
}
Enumeration e = Project.Enumerations.FirstOrDefault(_ => string.Equals(_.Name, "FilterFunction", StringComparison.OrdinalIgnoreCase) || string.Equals(_.Name, "FilterFunctions", StringComparison.OrdinalIgnoreCase));
if (e != null)
return e;
e = new Enumeration();
e.Name = typeof(FilterFunctions).Name;
e.Namespace = Project.DefaultNamespace;
e.IsFlags = Project.GetAttributeValue("createMultiValuedEnumeration", NamespaceUri, true);
e.SetAttributeValue(PreferredPrefix, "isFilterFunctionsEnumeration", NamespaceUri, true);
Project.Enumerations.Add(e);
foreach (FilterFunctions value in ConvertUtilities.EnumEnumerateValues<FilterFunctions>())
{
EnumerationValue enumerationValue = new EnumerationValue();
enumerationValue.Name = value.ToString();
enumerationValue.SetAttributeValue(PreferredPrefix, "filterFunction", NamespaceUri, value);
e.Values.Add(enumerationValue);
}
return e;
}
示例2: FindOrCreateFilterFunctionsEnumeration
private Enumeration FindOrCreateFilterFunctionsEnumeration()
{
foreach (Enumeration enumeration in Project.Enumerations)
{
if (enumeration.GetAttributeValue("isFilterFunctionsEnumeration", NamespaceUri, false))
{
return enumeration;
}
}
Enumeration e = Project.Enumerations.FirstOrDefault(_ => string.Equals(_.Name, "FilterFunction", StringComparison.OrdinalIgnoreCase) || string.Equals(_.Name, "FilterFunctions", StringComparison.OrdinalIgnoreCase));
if (e != null)
return e;
e = new Enumeration();
e.Name = typeof(FilterFunctions).Name;
e.Namespace = Project.DefaultNamespace;
e.IsFlags = Project.GetAttributeValue("createMultiValuedEnumeration", NamespaceUri, true);
e.SetAttributeValue(PreferredPrefix, "isFilterFunctionsEnumeration", NamespaceUri, true);
Project.Enumerations.Add(e);
foreach (FilterFunctions value in ConvertUtilities.EnumEnumerateValues<FilterFunctions>())
{
EnumerationValue enumerationValue = new EnumerationValue();
enumerationValue.Name = value.ToString();
enumerationValue.SetAttributeValue(PreferredPrefix, "filterFunction", NamespaceUri, value);
List<string> enumNames = ConvertUtilities.SplitEnumNames(value).ToList();
if (enumNames.Count() > 1)
{
if (!e.IsFlags)
continue;
enumerationValue.Value = ConvertUtilities.Concatenate(enumNames, " | ");
}
else
{
enumerationValue.Value = ((int)value).ToString(CultureInfo.InvariantCulture);
}
enumerationValue.Value = ((int)value).ToString(CultureInfo.InvariantCulture);
e.Values.Add(enumerationValue);
}
return e;
}