Exemplo n.º 1
0
        /// <summary>
        /// Gets the <see cref='System.Data.DataColumn'/> from the collection with the specified name.
        /// </summary>
        public DataColumn?this[string name]
        {
            get
            {
                if (null == name)
                {
                    throw ExceptionBuilder.ArgumentNull(nameof(name));
                }

                DataColumn?column;
                if ((!_columnFromName.TryGetValue(name, out column)) || (column == null))
                {
                    // Case-Insensitive compares
                    int index = IndexOfCaseInsensitive(name);
                    if (0 <= index)
                    {
                        column = (DataColumn)_list[index] !;
                    }
                    else if (-2 == index)
                    {
                        throw ExceptionBuilder.CaseInsensitiveNameConflict(name);
                    }
                }

                return(column);
            }
        }
Exemplo n.º 2
0
 /// <devdoc>
 /// <para>Gets the <see cref='System.Data.Constraint'/> from the collection with the specified name.</para>
 /// </devdoc>
 public Constraint this[string name] {
     get {
         int index = InternalIndexOf(name);
         if (index == -2)
         {
             throw ExceptionBuilder.CaseInsensitiveNameConflict(name);
         }
         return((index < 0) ? null : (Constraint)List[index]);
     }
 }
Exemplo n.º 3
0
 public override DataRelation this[string name] {
     get {
         int index = InternalIndexOf(name);
         if (index == -2)
         {
             throw ExceptionBuilder.CaseInsensitiveNameConflict(name);
         }
         return((index < 0) ? null : (DataRelation)List[index]);
     }
 }
 public DataTable this[string name, string tableNamespace] {
     get {
         if (tableNamespace == null)
         {
             throw ExceptionBuilder.ArgumentNull("tableNamespace");
         }
         int index = InternalIndexOf(name, tableNamespace);
         if (index == -2)
         {
             throw ExceptionBuilder.CaseInsensitiveNameConflict(name);
         }
         return((index < 0) ? null : (DataTable)_list[index]);
     }
 }
 /// <devdoc>
 ///    <para>Gets the table in the collection with the given name (not case-sensitive).</para>
 /// </devdoc>
 public DataTable this[string name] {
     get {
         int index = InternalIndexOf(name);
         if (index == -2)
         {
             throw ExceptionBuilder.CaseInsensitiveNameConflict(name);
         }
         if (index == -3)
         {
             throw ExceptionBuilder.NamespaceNameConflict(name);
         }
         return((index < 0) ? null : (DataTable)_list[index]);
     }
 }
Exemplo n.º 6
0
 public Constraint this[string name]
 {
     get
     {
         int num = this.InternalIndexOf(name);
         if (num == -2)
         {
             throw ExceptionBuilder.CaseInsensitiveNameConflict(name);
         }
         if (num >= 0)
         {
             return((Constraint)this.List[num]);
         }
         return(null);
     }
 }
 public override DataRelation this[string name]
 {
     get
     {
         int num = base.InternalIndexOf(name);
         if (num == -2)
         {
             throw ExceptionBuilder.CaseInsensitiveNameConflict(name);
         }
         if (num >= 0)
         {
             return((DataRelation)this.List[num]);
         }
         return(null);
     }
 }
Exemplo n.º 8
0
        /// <include file='doc\DataColumnCollection.uex' path='docs/doc[@for="DataColumnCollection.this1"]/*' />
        /// <devdoc>
        /// <para>Gets the <see cref='System.Data.DataColumn'/> from the collection with the specified name.</para>
        /// </devdoc>
        public virtual DataColumn this[string name] {
            get {
                DataColumn column = (DataColumn)columnFromName[name];
                if (column != null)
                {
                    return(column);
                }

                // Case-Insensitive compares
                int index = IndexOfCaseInsensitive(name);
                if (index == -2)
                {
                    throw ExceptionBuilder.CaseInsensitiveNameConflict(name);
                }
                return((index < 0) ? null : (DataColumn)List[index]);
            }
        }
Exemplo n.º 9
0
 public DataTable this[string name, string tableNamespace]
 {
     get
     {
         if (tableNamespace == null)
         {
             throw ExceptionBuilder.ArgumentNull("tableNamespace");
         }
         int num = this.InternalIndexOf(name, tableNamespace);
         if (num == -2)
         {
             throw ExceptionBuilder.CaseInsensitiveNameConflict(name);
         }
         if (num >= 0)
         {
             return((DataTable)this._list[num]);
         }
         return(null);
     }
 }
Exemplo n.º 10
0
        public DataTable this[string name]
        {
            get
            {
                int num = this.InternalIndexOf(name);
                switch (num)
                {
                case -2:
                    throw ExceptionBuilder.CaseInsensitiveNameConflict(name);

                case -3:
                    throw ExceptionBuilder.NamespaceNameConflict(name);
                }
                if (num >= 0)
                {
                    return((DataTable)this._list[num]);
                }
                return(null);
            }
        }
 public DataColumn this[string name]
 {
     get
     {
         if (name == null)
         {
             throw ExceptionBuilder.ArgumentNull("name");
         }
         DataColumn column = this.columnFromName[name] as DataColumn;
         if (column == null)
         {
             int num = this.IndexOfCaseInsensitive(name);
             if (0 <= num)
             {
                 return((DataColumn)this._list[num]);
             }
             if (-2 == num)
             {
                 throw ExceptionBuilder.CaseInsensitiveNameConflict(name);
             }
         }
         return(column);
     }
 }