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);

VB.net

○.Config – AppSetting

    Public ReadOnly Property GetAppSettings(ByVal key As String) As Object
        Get
            Dim val As Object = System.Configuration.ConfigurationManager.AppSettings(key)
            If val Is Nothing Then Throw New Exception("AppSettingsに " & key & " は設定されていません")
            Return val
        End Get
    End Property

    Public ReadOnly Property GetAppSettings(ByVal key As String, ByVal defVal As Object) As Object
        Get
            If IsAppSettings(key) = False Then
                Return defVal
            Else
                Return GetAppSettings(key)
            End If
        End Get
    End Property

    Public ReadOnly Property IsAppSettings(ByVal key As String) As Boolean
        Get
            Return (Not System.Configuration.ConfigurationManager.AppSettings(key) Is Nothing)
        End Get
    End Property

VB.netなど

○Environment.OSVersionで正しいバージョンが取得できない場合、
マニフェストを追加する必要がある(Windows8.1以降など)

   ・・・
    </trustInfo>
    <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> 
        <application> 
            <!-- Windows 10 --> 
            <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
            <!-- Windows 8.1 -->
            <!-- supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/-->
        </application> 
    </compatibility> 

参考:Windows 10対応アプリを作るためのマニフェスト互換情報