123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Xml.Linq;
- namespace Bowin.Common.Linq
- {
- public static class XmlExtensions
- {
- public static string ValueOrDefault(this XElement xele, string DefaultValue)
- {
- string result = "";
- if (xele != null)
- result = xele.Value;
- else
- result = DefaultValue;
- return result;
- }
- public static string ValueOrDefault(this XElement xele)
- {
- return xele.ValueOrDefault("");
- }
- public static string ValueOrDefault(this XAttribute xele, string DefaultValue)
- {
- string result = "";
- if (xele != null)
- result = xele.Value;
- else
- result = DefaultValue;
- return result;
- }
- public static string ValueOrDefault(this XAttribute xele)
- {
- return xele.ValueOrDefault("");
- }
- }
- }
|