C#

○.config – AppSettings

        public static string getConfValue(string name)
        {
            return ConfigurationManager.AppSettings[name];
        }

        public static string getConfValue(string name, string defValue)
        {
            if (isConfValue(name))
                return getConfValue(name);
            else
                return defValue;
        }

        public static bool isConfValue(string name)
        {
            return (Array.IndexOf(ConfigurationManager.AppSettings.AllKeys, name) >= 0);
        }

        public static eAppMode AppMode
        {
            get
            {                    
                if (isConfValue("APP_MODE"))
                    return eAppMode.Dev;
                else
                    return eAppMode.Non;
            }

        }

○プロパティ名を取得する

        public static string GetName(System.Linq.Expressions.Expression<Func> e)
        {
            var member = (System.Linq.Expressions.MemberExpression)e.Body;
            return member.Member.Name;
        }

        //使い方
        string s = GetName(() => DateTime.Today);