ソースコード
using System.Xml; public static class XmlExt { public static string GetValueOrDefault ( this XmlAttribute self, string defaultValue = "" ) { return self != null ? self.Value : defaultValue; } }
使い方
var attr = node.Attributes[ "name" ]; var value = attr.GetValueOrDefault();