Git.Storage.Common/EnumJson/EnumToJsonHelper.cs

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

/*******************************************************************************
 * Copyright (C) Git Corporation. All rights reserved.
 *
 * Author: 微软
 * Create Date: 2017-01-01 14:38:43
 *
 * Description: Git.Framework
 * www.baidu.com
 * .NET强大仓储管理系统:http://yun.gitwms.com/
 * .NET强大仓储管理系统:http://www.gitwms.com/
 * 
 * Revision History:
 * Date         Author               Description
 * 2013-09-01 15:10:06       微软
*********************************************************************************/

using Git.Framework.DataTypes;
using Git.Framework.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Git.Framework.DataTypes.ExtensionMethods;

namespace Git.Storage.Common.EnumJson
{
    public partial class EnumToJsonHelper
    {
        private static IDictionary<string, Type> listType = null;

        /// <summary>
        /// 注册枚举值类型
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="en"></param>
        /// <returns></returns>
        public static void Reg<T>(T en)
        {
            listType = listType.IsNull() ? new Dictionary<string, Type>() : listType;
            Type type = typeof(T);
            string name = type.Name;
            if (!listType.ContainsKey(name))
            {
                listType.Add(name, type);
            }
        }

        /// <summary>
        /// 注册枚举值类型
        /// </summary>
        /// <param name="type"></param>
        public static void Reg(params Type[] types)
        {
            listType = listType.IsNull() ? new Dictionary<string, Type>() : listType;
            if (types != null)
            {
                foreach (Type type in types)
                {
                    string name = type.Name;
                    if (!listType.ContainsKey(name))
后面还有 89 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。