Novell.Directory.Ldap.LdapSchema.getSchemaElement C# (CSharp) Method

getSchemaElement() private method

This function abstracts retrieving LdapSchemaElements from the local copy of schema in this LdapSchema class. This is used by getXXX(String name) functions. Note that the nameTable has all keys cast to Upper-case. This is so we can have a case-insensitive HashMap. The getXXX (String key) methods will also cast to uppercase. The first character of a NAME string can only be an alpha character (see section 4.1 of rfc2252) Thus if the first character is a digit we can conclude it is an OID. Note that this digit is ASCII only.
private getSchemaElement ( int schemaType, System key ) : LdapSchemaElement
schemaType int Specifies which list is to be used in schema /// lookup. ///
key System The key can be either an OID or a name string. ///
return LdapSchemaElement
        private LdapSchemaElement getSchemaElement(int schemaType, System.String key)
        {
            if ((System.Object) key == null || key.ToUpper().Equals("".ToUpper()))
                return null;
            char c = key[0];
            if (c >= '0' && c <= '9')
            {
                //oid lookup
                return (LdapSchemaElement) idTable[schemaType][key];
            }
            else
            {
                //name lookup
                return (LdapSchemaElement) nameTable[schemaType][key.ToUpper()];
            }
        }