本文整理汇总了C#中System.Xml.XmlAttributeCollection.OfType方法的典型用法代码示例。如果您正苦于以下问题:C# XmlAttributeCollection.OfType方法的具体用法?C# XmlAttributeCollection.OfType怎么用?C# XmlAttributeCollection.OfType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlAttributeCollection
的用法示例。
在下文中一共展示了XmlAttributeCollection.OfType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ValueAttributes
private IEnumerable<XmlAttribute> ValueAttributes(XmlAttributeCollection c)
{
return c.OfType<XmlAttribute>().Where(a => a.NamespaceURI != JsonNamespaceUri);
}
示例2: ReadFileListAttributes
/// <summary>
/// Reads the attributes from the "FileList" element of the SDK manifest.
/// </summary>
private void ReadFileListAttributes(XmlAttributeCollection attributes)
{
foreach (XmlAttribute attribute in attributes.OfType<XmlAttribute>())
{
string value = attribute.Value.Trim();
if (value.Length > 0)
{
if (attribute.Name.StartsWith(SDKManifest.Attributes.FrameworkIdentity, StringComparison.OrdinalIgnoreCase))
{
if (_frameworkIdentities == null)
{
_frameworkIdentities = new Dictionary<string, string>();
}
_frameworkIdentities.Add(attribute.Name, value);
continue;
}
if (attribute.Name.StartsWith(SDKManifest.Attributes.APPX, StringComparison.OrdinalIgnoreCase))
{
if (_appxLocations == null)
{
_appxLocations = new Dictionary<string, string>();
}
_appxLocations.Add(attribute.Name, value);
continue;
}
switch (attribute.Name)
{
case SDKManifest.Attributes.TargetPlatform:
TargetPlatform = value;
break;
case SDKManifest.Attributes.TargetPlatformMinVersion:
TargetPlatformMinVersion = value;
break;
case SDKManifest.Attributes.TargetPlatformVersion:
TargetPlatformVersion = value;
break;
case SDKManifest.Attributes.MinVSVersion:
MinVSVersion = value;
break;
case SDKManifest.Attributes.MinOSVersion:
_minOSVersion = value;
break;
case SDKManifest.Attributes.MaxOSVersionTested:
_maxOSVersionTested = value;
break;
case SDKManifest.Attributes.MaxPlatformVersion:
_maxPlatformVersion = value;
break;
case SDKManifest.Attributes.PlatformIdentity:
PlatformIdentity = value;
break;
case SDKManifest.Attributes.SupportPrefer32Bit:
SupportPrefer32Bit = value;
break;
case SDKManifest.Attributes.SupportsMultipleVersions:
if (!ParseSupportMultipleVersions(value))
{
_supportsMultipleVersions = MultipleVersionSupport.Allow;
}
break;
case SDKManifest.Attributes.SDKType:
Enum.TryParse<SDKType>(value, out _sdkType);
break;
case SDKManifest.Attributes.DisplayName:
DisplayName = value;
break;
case SDKManifest.Attributes.MoreInfo:
MoreInfo = value;
break;
case SDKManifest.Attributes.CopyRedistToSubDirectory:
CopyRedistToSubDirectory = value;
break;
case SDKManifest.Attributes.SupportedArchitectures:
SupportedArchitectures = value;
break;
case SDKManifest.Attributes.DependsOnSDK:
DependsOnSDK = value;
break;
case SDKManifest.Attributes.ProductFamilyName:
ProductFamilyName = value;
break;
}
}
}
}