C# Class Utility.Setting

配置信息类,该类为静态类,直接使用即可. 配置的key不区分大小写
FileName: Setting.cs CLRVersion: 4.0.30319.18444 Author: Devin DateTime: 2016/1/24 21:49:44 GitHub: https://github.com/v5bep7/Utility
Datei anzeigen Open project: v5bep7/Utility

Public Methods

Method Description
GetBoolean ( string key, bool def = default(bool) ) : bool

获取bool型类型配置信息值

GetByte ( string key, byte def = default(byte) ) : byte

获取byte类型的配置信息

GetChar ( string key, char def = default(char) ) : char

获取char类型配置信息值

GetDateTime ( string key, System.DateTime def = default(DateTime) ) : System.DateTime

获取DataTime类型配置信息值

GetDecimal ( string key, decimal def = default(decimal) ) : decimal

获取decimal类型的配置信息

GetDouble ( string key, double def = default(double) ) : double

获取double类型的配置信息

GetFloat ( string key, float def = default(float) ) : float

获取float类型的配置信息

GetGuid ( string key, System.Guid def = default(Guid) ) : System.Guid

获取Guid类型配置信息值

GetInt ( string key, int def = default(int) ) : int

获取int类型的配置信息值

GetLong ( string key, long def = default(long) ) : long

获取long类型的配置信息值

GetShort ( string key, short def = default(short) ) : short

获取short类型的配置信息

GetString ( string key, string def = "" ) : string

获取字符串类型设置信息

Load ( string path ) : void

从文件加载配置信息

Remove ( ) : void

移除配置仓储里面的多个配置信息

Remove ( string key ) : void

根据key移除配置仓储里面的配置信息

Save ( string path ) : void

将配置信息保存到文件

Set ( string>.IDictionary data ) : void

设置配置信息. 往配置仓储添加配置,如果仓储里面存在该key,则覆盖该key对应的值

Set ( string key, string value ) : void

设置配置信息 往配置仓储添加配置,如果仓储里面存在改key,则覆盖该key对应的值

Private Methods

Method Description
Setting ( ) : System

静态构造方法

Method Details

GetBoolean() public static method

获取bool型类型配置信息值
public static GetBoolean ( string key, bool def = default(bool) ) : bool
key string key
def bool 默认值
return bool

GetByte() public static method

获取byte类型的配置信息
public static GetByte ( string key, byte def = default(byte) ) : byte
key string key
def byte 默认值
return byte

GetChar() public static method

获取char类型配置信息值
public static GetChar ( string key, char def = default(char) ) : char
key string key
def char 默认值
return char

GetDateTime() public static method

获取DataTime类型配置信息值
public static GetDateTime ( string key, System.DateTime def = default(DateTime) ) : System.DateTime
key string key
def System.DateTime 默认值
return System.DateTime

GetDecimal() public static method

获取decimal类型的配置信息
public static GetDecimal ( string key, decimal def = default(decimal) ) : decimal
key string key
def decimal 默认值
return decimal

GetDouble() public static method

获取double类型的配置信息
public static GetDouble ( string key, double def = default(double) ) : double
key string key
def double 默认值
return double

GetFloat() public static method

获取float类型的配置信息
public static GetFloat ( string key, float def = default(float) ) : float
key string key
def float 默认值
return float

GetGuid() public static method

获取Guid类型配置信息值
public static GetGuid ( string key, System.Guid def = default(Guid) ) : System.Guid
key string key
def System.Guid 默认值
return System.Guid

GetInt() public static method

获取int类型的配置信息值
public static GetInt ( string key, int def = default(int) ) : int
key string key
def int 默认值
return int

GetLong() public static method

获取long类型的配置信息值
public static GetLong ( string key, long def = default(long) ) : long
key string key
def long 默认值
return long

GetShort() public static method

获取short类型的配置信息
public static GetShort ( string key, short def = default(short) ) : short
key string key
def short 默认值
return short

GetString() public static method

获取字符串类型设置信息
public static GetString ( string key, string def = "" ) : string
key string key
def string 默认值
return string

Load() public static method

从文件加载配置信息
public static Load ( string path ) : void
path string 完整的文件名(路径+文件名)
return void

Remove() public static method

移除配置仓储里面的多个配置信息
public static Remove ( ) : void
return void

Remove() public static method

根据key移除配置仓储里面的配置信息
public static Remove ( string key ) : void
key string 要移除的key
return void

Save() public static method

将配置信息保存到文件
public static Save ( string path ) : void
path string 完整的文件名(路径+文件名)
return void

Set() public static method

设置配置信息. 往配置仓储添加配置,如果仓储里面存在该key,则覆盖该key对应的值
public static Set ( string>.IDictionary data ) : void
data string>.IDictionary 要往字典里面添加配置的信息集合
return void

Set() public static method

设置配置信息 往配置仓储添加配置,如果仓储里面存在改key,则覆盖该key对应的值
public static Set ( string key, string value ) : void
key string
value string
return void