System.Data.SqlClient.SqlParameter.BinarySize C# (CSharp) Méthode

BinarySize() private static méthode

private static BinarySize ( object value, bool isSqlType ) : int
value object
isSqlType bool
Résultat int
        private static int BinarySize(object value, bool isSqlType)
        {
            if (isSqlType)
            {
                Debug.Assert(!((INullable)value).IsNull, "Should not call StringSize on null values");
                if (value is SqlBinary)
                {
                    return ((SqlBinary)value).Length;
                }
                if (value is SqlBytes)
                {
                    return ((SqlBytes)value).Value.Length;
                }
            }
            else
            {
                byte[] bvalue = (value as byte[]);
                if (null != bvalue)
                {
                    return bvalue.Length;
                }
                if (value is byte)
                {
                    return 1;
                }
            }

            // Didn't match, unknown size
            return 0;
        }