System.Data.DataKey.ColumnsEqual C# (CSharp) Method

ColumnsEqual() static private method

static private ColumnsEqual ( DataColumn column1, DataColumn column2 ) : bool
column1 DataColumn
column2 DataColumn
return bool
        internal static bool ColumnsEqual(DataColumn[] column1, DataColumn[] column2)
        {
            if (column1 == column2)
            {
                return true;
            }
            else if (column1 == null || column2 == null)
            {
                return false;
            }
            else if (column1.Length != column2.Length)
            {
                return false;
            }
            else
            {
                int i, j;
                for (i = 0; i < column1.Length; i++)
                {
                    bool check = false;
                    for (j = 0; j < column2.Length; j++)
                    {
                        if (column1[i].Equals(column2[j]))
                        {
                            check = true;
                            break;
                        }
                    }
                    if (!check)
                    {
                        return false;
                    }
                }
            }
            return true;
        }

Same methods

DataKey::ColumnsEqual ( DataKey key ) : bool

Usage Example

Beispiel #1
0
        // If we're not in a DataSet relations collection, we need to verify on every property get that we're
        // still a good relation object.
        internal override void CheckState()
        {
            if (_DataSet == null)
            {
                // Make sure columns arrays are valid
                parentKey.CheckState();
                childKey.CheckState();

                if (parentKey.Table.DataSet != childKey.Table.DataSet)
                {
                    throw ExceptionBuilder.TablesInDifferentSets();
                }

                for (int i = 0; i < parentKey.Columns.Length; i++)
                {
                    if (parentKey.Columns[i].DataType != childKey.Columns[i].DataType)
                    {
                        throw ExceptionBuilder.ColumnsTypeMismatch();
                    }
                }

                if (childKey.ColumnsEqual(parentKey))
                {
                    throw ExceptionBuilder.KeyColumnsIdentical();
                }
            }
        }
All Usage Examples Of System.Data.DataKey::ColumnsEqual