System.Xml.Res.GetString C# (CSharp) Méthode

GetString() public static méthode

public static GetString ( string s ) : string
s string
Résultat string
		public static string GetString (string s, params object [] args)
		{
			return args == null ? s : string.Format (s, args);
		}
	}

Usage Example

        public virtual void AddNamespace(string prefix, string uri)
        {
            if (uri == null)
            {
                throw new ArgumentNullException("uri");
            }

            if (prefix == null)
            {
                throw new ArgumentNullException("prefix");
            }

            prefix = nameTable.Add(prefix);
            uri    = nameTable.Add(uri);

            if ((Ref.Equal(xml, prefix) && !uri.Equals(XmlReservedNs.NsXml)))
            {
                throw new ArgumentException(Res.GetString(Res.Xml_XmlPrefix));
            }
            if (Ref.Equal(xmlNs, prefix))
            {
                throw new ArgumentException(Res.GetString(Res.Xml_XmlnsPrefix));
            }

            int declIndex         = LookupNamespaceDecl(prefix);
            int previousDeclIndex = -1;

            if (declIndex != -1)
            {
                if (nsdecls[declIndex].scopeId == scopeId)
                {
                    // redefine if in the same scope
                    nsdecls[declIndex].uri = uri;
                    return;
                }
                else
                {
                    // othewise link
                    previousDeclIndex = declIndex;
                }
            }

            // set new namespace declaration
            if (lastDecl == nsdecls.Length - 1)
            {
                NamespaceDeclaration[] newNsdecls = new NamespaceDeclaration[nsdecls.Length * 2];
                Array.Copy(nsdecls, 0, newNsdecls, 0, nsdecls.Length);
                nsdecls = newNsdecls;
            }

            nsdecls[++lastDecl].Set(prefix, uri, scopeId, previousDeclIndex);

            // add to hashTable
            if (useHashtable)
            {
                hashTable[prefix] = lastDecl;
            }
            // or create a new hashTable if the threashold has been reached
            else if (lastDecl >= MinDeclsCountForHashtable)
            {
                // add all to hash table
                Debug.Assert(hashTable == null);
                hashTable = new Dictionary <string, int>(lastDecl);
                for (int i = 0; i <= lastDecl; i++)
                {
                    hashTable[nsdecls[i].prefix] = i;
                }
                useHashtable = true;
            }
        }
All Usage Examples Of System.Xml.Res::GetString