System.Data.Common.ADP.WrongType C# (CSharp) Méthode

WrongType() static private méthode

static private WrongType ( Type got, Type expected ) : Exception
got Type
expected Type
Résultat Exception
        static internal Exception WrongType(Type got, Type expected)
        {
            return Argument(Res.GetString(Res.SQL_WrongType, got.ToString(), expected.ToString()));
        }

Usage Example

        /// <include file='doc\DBDataPermission.uex' path='docs/doc[@for="DBDataPermission.IsSubsetOf"]/*' />
        override public bool IsSubsetOf(IPermission target)
        {
            if (null == target)
            {
                return(IsEmpty());
            }
            if (target.GetType() != this.GetType())
            {
                throw ADP.WrongType(this.GetType());
            }
            DBDataPermission superset = (target as DBDataPermission);

#if DATAPERMIT
            if (null != superset._keyvalues)
            {
                Debug.WriteLine("+ " + (superset._keyvalues[0] as DBConnectionString).ConnectionString);
            }
            else
            {
                Debug.WriteLine("+ <>");
            }
            if (null != _keyvalues)
            {
                Debug.WriteLine("- " + (_keyvalues[0] as DBConnectionString).ConnectionString);
            }
            else
            {
                Debug.WriteLine("- <>");
            }
#endif
            bool subset = superset.IsUnrestricted();
            if (!subset)
            {
                subset = (!IsUnrestricted() &&
                          (!AllowBlankPassword || superset.AllowBlankPassword) &&
                          ((null == _keyvalues) || (null != superset._keyvaluetree)));

                if (subset && (null != _keyvalues))
                {
                    foreach (DBConnectionString kventry in _keyvalues)
                    {
                        if (!superset._keyvaluetree.CheckValueForKeyPermit(kventry))
                        {
                            subset = false;
                            break;
                        }
                    }
                }
            }
            return(subset);
        }
ADP