- 字符串Remove特殊字符:
char
[] chRemove
=
...
{ ' ','e','C'}
;
string strSample = " This is a sample " ;
strSample = strSample.Trim(chRemove);
string strSample = " This is a sample " ;
strSample = strSample.Trim(chRemove);
- 枚举变量的解析:
public
enum
eBasInfo
...
{ UpdateTitle, NewVersion, UpdateDate }
;
// 如下可以获得类似索引整数0
int nNum = ( int )Enum.Parse( typeof (eBasInfo), " UpdateTitle " .Trim(), true );
// 如下可以获得枚举值
eBasInfo nNum = (eBasInfo)Enum.Parse( typeof (eBasInfo), " UpdateTitle " .Trim(), true );
// 如下可以获得类似索引整数0
int nNum = ( int )Enum.Parse( typeof (eBasInfo), " UpdateTitle " .Trim(), true );
// 如下可以获得枚举值
eBasInfo nNum = (eBasInfo)Enum.Parse( typeof (eBasInfo), " UpdateTitle " .Trim(), true );