Iman.Utility/Dictionary/SiteDictionaryHelp.cs

(完整代码) 900B

using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;

namespace Iman.Utility.Dictionary
{
   public class SiteDictionaryHelp
    {
        public static string GetEnumNameFromValue(Type enumType, string enumValue)
        {
            return Enum.Parse(enumType, enumValue).ToString();
        }

        public static string GetEnumValueFromName(Type enumType, string enumName)
        {
            Array array = Enum.GetValues(enumType);
            IEnumerator e = array.GetEnumerator();
            e.Reset();

            int result = 0;
            while (e.MoveNext())
            {
                if (e.Current.ToString() == enumName)
                {
                    result = (int)e.Current;
                    break;
                }
            }
            return result.ToString();
        }
    }
}

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

AI 解读

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

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