System.Runtime.Serialization.SchemaHelper.NamespacesEqual C# (CSharp) Method

NamespacesEqual() static private method

static private NamespacesEqual ( string ns1, string ns2 ) : bool
ns1 string
ns2 string
return bool
        internal static bool NamespacesEqual(string ns1, string ns2)
        {
            if (ns1 == null || ns1.Length == 0)
                return (ns2 == null || ns2.Length == 0);
            else
                return ns1 == ns2;
        }

Usage Example

コード例 #1
0
ファイル: SchemaHelper.cs プロジェクト: zpk513/corefx
        internal static void AddSchemaImport(string ns, XmlSchema schema)
        {
            if (SchemaHelper.NamespacesEqual(ns, schema.TargetNamespace) || SchemaHelper.NamespacesEqual(ns, Globals.SchemaNamespace) || SchemaHelper.NamespacesEqual(ns, Globals.SchemaInstanceNamespace))
            {
                return;
            }

            foreach (object item in schema.Includes)
            {
                if (item is XmlSchemaImport)
                {
                    if (SchemaHelper.NamespacesEqual(ns, ((XmlSchemaImport)item).Namespace))
                    {
                        return;
                    }
                }
            }

            XmlSchemaImport import = new XmlSchemaImport();

            if (ns != null && ns.Length > 0)
            {
                import.Namespace = ns;
            }
            schema.Includes.Add(import);
        }