zoukankan      html  css  js  c++  java
  • C#类型转换3

    namespace WDBuyNET.DMSFrame.Utils
    {
        public static class TypeExtentions
        {
            public static bool IsPrimitive(this Type t)
            {
                bool result;
                if (t.IsGenericType)
                {
                    result = (TypeExtentions.IsNullableType(t) && TypeExtentions.IsPrimitive(Nullable.GetUnderlyingType(t)));
                }
                else
                {
                    bool arg_14F_0;
                    if (!(t == typeof(string)) && !(t == typeof(short)) && !(t == typeof(ushort)) && !(t == typeof(int)) && !(t == typeof(uint)) && !(t == typeof(long)) && !(t == typeof(ulong)) && !(t == typeof(float)) && !(t == typeof(double)) && !(t == typeof(decimal)) && !(t == typeof(char)) && !(t == typeof(byte)) && !(t == typeof(bool)) && !(t == typeof(DateTime)))
                    {
                        arg_14F_0 = (t == typeof(Guid));
                    }
                    else
                    {
                        arg_14F_0 = true;
                    }
                    result = arg_14F_0;
                }
                return result;
            }
            public static bool IsStringType(this Type type)
            {
                bool arg_80_0;
                if (!(type == typeof(string)) && !(type == typeof(bool)) && !(type == typeof(DateTime)) && !(type == typeof(Guid)) && !(type == typeof(bool?)) && !(type == typeof(DateTime?)))
                {
                    arg_80_0 = (type == typeof(Guid?));
                }
                else
                {
                    arg_80_0 = true;
                }
                return arg_80_0;
            }
            public static bool IsBooleanType(this Type type)
            {
                return TypeExtentions.GetUnderlyingType(type) == typeof(bool);
            }
            public static bool AllowsNullValue(this Type type)
            {
                return !type.IsValueType || TypeExtentions.IsNullableType(type);
            }
            public static bool IsNullableType(this Type type)
            {
                return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable);
            }
            public static Type GetUnderlyingType(this Type type)
            {
                return TypeExtentions.IsNullableType(type) ? Nullable.GetUnderlyingType(type) : type;
            }
            public static string Join(this string[] array, char splitChar)
            {
                StringBuilder stringBuilder = new StringBuilder();
                for (int i = 0; i < array.Length; i++)
                {
                    stringBuilder.Append(array[i]);
                    stringBuilder.Append(splitChar);
                }
                return stringBuilder.ToString().TrimEnd(new char[]
                {
                    splitChar
                });
            }
            public static object DefaultValue(this Type type)
            {
                return type.IsValueType ? Activator.CreateInstance(type) : null;
            }
            public static string MD5(this string text)
            {
                byte[] bytes = Encoding.Default.GetBytes(text);
                MD5CryptoServiceProvider mD5CryptoServiceProvider = new MD5CryptoServiceProvider();
                byte[] array = mD5CryptoServiceProvider.ComputeHash(bytes);
                string text2 = "";
                byte[] array2 = array;
                for (int i = 0; i < array2.Length; i++)
                {
                    byte b = array2[i];
                    text2 = ((b >= 16) ? (text2 + b.ToString("X")) : (text2 + "0" + b.ToString("X")));
                }
                return text2.ToLower();
            }
        }
    }
  • 相关阅读:
    sqlplus中设定行大小、页大小、字符列格式、数字列格式、清屏
    位图索引
    B树索引
    Oracle列自增实现(3)-DEFAULT Values Using Sequences
    Oracle列自增实现(2)-Identity Columns in Oracle Database 12c Release 1 (12.1)
    oracle列自增实现(1)-Sequence+Trigger实现Oracle列自增
    ORA-01502: 索引或这类索引的分区处于不可用状态
    Oracle中的rowid
    Multitenant Architecture---PDB与CDB
    ODI Studio拓扑结构的创建与配置(Oracle)
  • 原文地址:https://www.cnblogs.com/hongjiumu/p/2686622.html
Copyright © 2011-2022 走看看