本文整理汇总了C#中System.GetString方法的典型用法代码示例。如果您正苦于以下问题:C# System.GetString方法的具体用法?C# System.GetString怎么用?C# System.GetString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System
的用法示例。
在下文中一共展示了System.GetString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ContractException
private ContractException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
: base(info, context)
{
_Kind = (ContractFailureKind)info.GetInt32("Kind");
_UserMessage = info.GetString("UserMessage");
_Condition = info.GetString("Condition");
}
示例2: ManagedException
protected ManagedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
: base(info, context)
{
mIsWrapper = false;
mMessage = info.GetString("ManagedException.Message");
mStackTrace = info.GetString("ManagedException.StackTrace");
}
示例3: VariantReference
private VariantReference(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
{
_valueReference = null;
_unityObjectReference = null;
_type = (VariantType)info.GetInt32("type");
switch (_type)
{
case VariantType.Object:
case VariantType.GameObject:
case VariantType.Component:
//do nothing
break;
case VariantType.Vector2:
case VariantType.Vector3:
case VariantType.Quaternion:
case VariantType.Color:
var arr = StringUtil.SplitFixedLength(info.GetString("vector"), ",", 4);
//_vectorStore = new Vector4(ConvertUtil.ToSingle(arr[0]),
// ConvertUtil.ToSingle(arr[1]),
// ConvertUtil.ToSingle(arr[2]),
// ConvertUtil.ToSingle(arr[3]));
break;
default:
_valueReference = info.GetString("value");
break;
}
(this as ISerializationCallbackReceiver).OnAfterDeserialize();
}
示例4: ReadValues
/// <summary>
/// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this
/// object's properties. The database column's name is used to as the key, so the value
/// will not be found if any aliases are used or not all columns were selected.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param>
public static void ReadValues(this AccountBanTable source, System.Data.IDataRecord dataRecord)
{
System.Int32 i;
i = dataRecord.GetOrdinal("account_id");
source.AccountID = (DemoGame.AccountID)(DemoGame.AccountID)dataRecord.GetInt32(i);
i = dataRecord.GetOrdinal("end_time");
source.EndTime = (System.DateTime)(System.DateTime)dataRecord.GetDateTime(i);
i = dataRecord.GetOrdinal("expired");
source.Expired = (System.Boolean)(System.Boolean)dataRecord.GetBoolean(i);
i = dataRecord.GetOrdinal("id");
source.ID = (System.Int32)(System.Int32)dataRecord.GetInt32(i);
i = dataRecord.GetOrdinal("issued_by");
source.IssuedBy = (System.String)(System.String)(dataRecord.IsDBNull(i) ? (System.String)null : dataRecord.GetString(i));
i = dataRecord.GetOrdinal("reason");
source.Reason = (System.String)(System.String)dataRecord.GetString(i);
i = dataRecord.GetOrdinal("start_time");
source.StartTime = (System.DateTime)(System.DateTime)dataRecord.GetDateTime(i);
}
示例5: HandlerNotFoundException
protected HandlerNotFoundException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
: base (info, context)
{
handler_name = info.GetString ("HandlerName");
signal_name = info.GetString ("SignalName");
evnt = info.GetValue ("Event", typeof (System.Reflection.EventInfo)) as System.Reflection.EventInfo;
delegate_type = info.GetValue ("DelegateType", typeof (Type)) as Type;
}
示例6: MapRow
public object MapRow(System.Data.IDataReader reader, int rowNum)
{
User model = new User();
model.id = reader.GetInt32(0);
model.name = reader.GetString(1);
model.pwd = reader.GetString(2);
return model;
}
示例7: Load
public override void Load(System.Data.IDataRecord record)
{
Id = record.GetInt32(0);
OKPO = record.GetString(1);
SOATO = record.GetString(2);
INN = record.GetString(3);
Name = record.GetString(4);
Type = (OrgType)record.GetByte(5);
}
示例8: PopulateDTO
public override DTOBase PopulateDTO(System.Data.IDataReader reader)
{
var credential = base.PopulateId(reader, new Credential());
if (!reader.IsDBNull(_ordinals.EmailAddress)) { credential.EmailAddress = reader.GetString(_ordinals.EmailAddress); }
if (!reader.IsDBNull(_ordinals.Salt)) { credential.Salt = reader.GetString(_ordinals.Salt); }
if (!reader.IsDBNull(_ordinals.PasswordHash)) { credential.PasswordHash = reader.GetString(_ordinals.PasswordHash); }
if (!reader.IsDBNull(_ordinals.CreateDateTimeUtc)) { credential.CreateDateTimeUtc = reader.GetDateTime(_ordinals.CreateDateTimeUtc); }
credential.IsNew = false;
return credential;
}
示例9: CommunityInfo
private CommunityInfo(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
: base(info, context)
{
this._id = info.GetInt32("id");
this._universalID = new Guid(info.GetString("universalID"));
this._title = info.GetString("title");
this._touched = info.GetDateTime("touched");
// setup events
this.SetupEvents();
}
示例10: SiteInfo
private SiteInfo(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
: base(info, context)
{
this._id = info.GetInt32("id");
this._domain = info.GetString("domain");
this._subDomain = info.GetString("subDomain");
this._touched = info.GetDateTime("touched");
this._section_id = info.GetInt32("section_id");
this._originalTheme = info.GetString("originalTheme");
this._originalStyle = info.GetString("originalStyle");
}
示例11: populateDTO
/// <summary>
/// Permet remplir les propriétés de mappage de l'entité admin.
/// </summary>
/// <param name="reader">reader contenant les données.</param>
/// <returns>Un objet adminDTO.</returns>
public override Mappage.DTOBase populateDTO(System.Data.SqlClient.SqlDataReader reader)
{
adminDTO admin = new adminDTO();
if (!reader.IsDBNull(ordAdminGuid)) { admin.adminGuid = reader.GetGuid(ordAdminGuid); }
if (!reader.IsDBNull(ordAdminLogin)) { admin.adminLogin = reader.GetString(ordAdminLogin); }
if (!reader.IsDBNull(ordAdminPassword)) { admin.adminPassword = reader.GetString(ordAdminPassword); }
admin.isNew = false;
return admin;
}
示例12: populateDTO
/// <summary>
/// Permet remplir les propriétés de mappage de l'entité métier.
/// </summary>
/// <param name="reader">reader contenant les données.</param>
/// <returns>Un objet metierDTO.</returns>
public override Mappage.DTOBase populateDTO(System.Data.SqlClient.SqlDataReader reader)
{
metierDTO metier = new metierDTO();
if (!reader.IsDBNull(ordMetierGuid)) { metier.metierGuid = reader.GetGuid(ordMetierGuid); }
if (!reader.IsDBNull(ordMetierNom)) { metier.metierNom = reader.GetString(ordMetierNom); }
if (!reader.IsDBNull(ordMetierFiche)) { metier.metierFiche = reader.GetString(ordMetierFiche); }
if (!reader.IsDBNull(ordMetierScoreReseau)) { metier.metierScoreReseau = reader.GetInt32(ordMetierScoreReseau); }
if (!reader.IsDBNull(ordMetierScoreLogiciel)) { metier.metierScorelogiciel = reader.GetInt32(ordMetierScoreLogiciel); }
metier.isNew = false;
return metier;
}
示例13: GetContent
/// <summary>
/// Replacement of "Content" property for RestSharp.Portable
/// </summary>
/// <param name="response"></param>
/// <param name="encoding"></param>
/// <returns></returns>
public static string GetContent(this IRestResponse response, System.Text.Encoding encoding)
{
var data = response.RawBytes;
if (data == null)
return null;
return encoding.GetString(data, 0, data.Length);
}
示例14: DecodingForString
/// <summary>
/// 从base64编码的字符串中还原字符串,支持中文
/// </summary>
/// <param name="base64String">base64加密后的字符串</param>
/// <param name="ens">System.Text.Encoding 对象,如创建中文编码集对象:System.Text.Encoding.GetEncoding(54936)</param>
/// <returns>还原后的文本字符串</returns>
public static string DecodingForString(string base64String, System.Text.Encoding ens)
{
/**
* ***********************************************************
*
* 从base64String中取得的字节值为字符的机内码(ansi字符编码)
* 一般的,用机内码转换为汉字是公式:
* (char)(第一字节的二进制值*256+第二字节值)
* 而在c#中的char或string由于采用了unicode编码,就不能按照上面的公式计算了
* ansi的字节编和unicode编码不兼容
* 故利用.net类库提供的编码类实现从ansi编码到unicode代码的转换
*
* GetEncoding 方法依赖于基础平台支持大部分代码页。但是,对于下列情况提供系统支持:默认编码,即在执行此方法的计算机的区域设置中指定的编码;Little-Endian Unicode (UTF-16LE);Big-Endian Unicode (UTF-16BE);Windows 操作系统 (windows-1252);UTF-7;UTF-8;ASCII 以及 GB18030(简体中文)。
*
*指定下表中列出的其中一个名称以获取具有对应代码页的系统支持的编码。
*
* 代码页 名称
* 1200 “UTF-16LE”、“utf-16”、“ucs-2”、“unicode”或“ISO-10646-UCS-2”
* 1201 “UTF-16BE”或“unicodeFFFE”
* 1252 “windows-1252”
* 65000 “utf-7”、“csUnicode11UTF7”、“unicode-1-1-utf-7”、“unicode-2-0-utf-7”、“x-unicode-1-1-utf-7”或“x-unicode-2-0-utf-7”
* 65001 “utf-8”、“unicode-1-1-utf-8”、“unicode-2-0-utf-8”、“x-unicode-1-1-utf-8”或“x-unicode-2-0-utf-8”
* 20127 “us-ascii”、“us”、“ascii”、“ANSI_X3.4-1968”、“ANSI_X3.4-1986”、“cp367”、“csASCII”、“IBM367”、“iso-ir-6”、“ISO646-US”或“ISO_646.irv:1991”
* 54936 “GB18030”
*
* 某些平台可能不支持特定的代码页。例如,Windows 98 的美国版本可能不支持日语 Shift-jis 代码页(代码页 932)。这种情况下,GetEncoding 方法将在执行下面的 C# 代码时引发 NotSupportedException:
*
* Encoding enc = Encoding.GetEncoding("shift-jis");
*
* **************************************************************/
//从base64String中得到原始字符
return ens.GetString(Convert.FromBase64String(base64String));
}
示例15: decodingforstring
///
/// 从base64编码的字符串中还原字符串,支持中文
///
/// base64加密后的字符串
/// system.text.encoding 对象,如创建中文编码集对象:system.text.encoding.getencoding(54936)
/// 还原后的文本字符串
public static string decodingforstring(string base64string, System.Text.Encoding ens)
{
/**
* ***********************************************************
*
* 从base64string中取得的字节值为字符的机内码(ansi字符编码)
* 一般的,用机内码转换为汉字是公式:
* (char)(第一字节的二进制值*256 第二字节值)
* 而在c#中的char或string由于采用了unicode编码,就不能按照上面的公式计算了
* ansi的字节编和unicode编码不兼容
* 故利用.net类库提供的编码类实现从ansi编码到unicode代码的转换
*
* getencoding 方法依赖于基础平台支持大部分代码页。但是,对于下列情况提供系统支持:默认编码,即在执行此方法的计算机的区域设置中指定的编码;little-endian unicode (utf-16le);big-endian unicode (utf-16be);windows 操作系统 (windows-1252);utf-7;utf-8;ascii 以及 gb18030(简体中文)。
*
*指定下表中列出的其中一个名称以获取具有对应代码页的系统支持的编码。
*
* 代码页 名称
* 1200 &#8220;utf-16le&#8221;、&#8220;utf-16&#8221;、&#8220;ucs-2&#8221;、&#8220;unicode&#8221;或&#8220;iso-10646-ucs-2&#8221;
* 1201 &#8220;utf-16be&#8221;或&#8220;unicodefffe&#8221;
* 1252 &#8220;windows-1252&#8221;
* 65000 &#8220;utf-7&#8221;、&#8220;csunicode11utf7&#8221;、&#8220;unicode-1-1-utf-7&#8221;、&#8220;unicode-2-0-utf-7&#8221;、&#8220;x-unicode-1-1-utf-7&#8221;或&#8220;x-unicode-2-0-utf-7&#8221;
* 65001 &#8220;utf-8&#8221;、&#8220;unicode-1-1-utf-8&#8221;、&#8220;unicode-2-0-utf-8&#8221;、&#8220;x-unicode-1-1-utf-8&#8221;或&#8220;x-unicode-2-0-utf-8&#8221;
* 20127 &#8220;us-ascii&#8221;、&#8220;us&#8221;、&#8220;ascii&#8221;、&#8220;ansi_x3.4-1968&#8221;、&#8220;ansi_x3.4-1986&#8221;、&#8220;cp367&#8221;、&#8220;csascii&#8221;、&#8220;ibm367&#8221;、&#8220;iso-ir-6&#8221;、&#8220;iso646-us&#8221;或&#8220;iso_646.irv:1991&#8221;
* 54936 &#8220;gb18030&#8221;
*
* 某些平台可能不支持特定的代码页。例如,windows 98 的美国版本可能不支持日语 shift-jis 代码页(代码页 932)。这种情况下,getencoding 方法将在执行下面的 c# 代码时引发 notsupportedexception:
*
* encoding enc = encoding.getencoding(shift-jis);
*
* **************************************************************/
//从base64string中得到原始字符
return ens.GetString(Convert.FromBase64String(base64string));
}