Example #1
0
 //3 ways how to get the XName
 public XName GetName(string name, string ns, GetNameType type)
 {
     switch (type)
     {
         case GetNameType.FromString:
             return (ns == null || ns.Length == 0) ? name : "{" + ns + "}" + name;
         case GetNameType.TwoParamGet:
             return XName.Get(name, ns);
         case GetNameType.ExpandedName:
             return (ns == null || ns.Length == 0) ? XName.Get(name) : XName.Get("{" + ns + "}" + name);
         case GetNameType.XNamespacePlusOperator:
             return (ns == null || ns.Length == 0) ? XName.Get(name) : XNamespace.Get(ns) + name;
         default:
             TestLog.Compare(false, "Test failed: Invalid XName creation method specified");
             break;
     }
     return null;
 }
Example #2
0
                //3 ways how to get the XName
                public XName GetName(string name, string ns, GetNameType type)
                {
                    switch (type)
                    {
                    case GetNameType.FromString:
                        return((ns == null || ns.Length == 0) ? name : "{" + ns + "}" + name);

                    case GetNameType.TwoParamGet:
                        return(XName.Get(name, ns));

                    case GetNameType.ExpandedName:
                        return((ns == null || ns.Length == 0) ? XName.Get(name) : XName.Get("{" + ns + "}" + name));

                    case GetNameType.XNamespacePlusOperator:
                        return((ns == null || ns.Length == 0) ? XName.Get(name) : XNamespace.Get(ns) + name);

                    default:
                        TestLog.Compare(false, "Test failed: Invalid XName creation method specified");
                        break;
                    }
                    return(null);
                }