一、字符串
// // 摘要: // 将 system.string 类的新实例初始化为由 unicode 字符数组指示的值。 // // 参数: // value: // unicode 字符的数组。 [securitysafecritical] public string(char[] value); // // 摘要: // 将 system.string 类的新实例初始化为由指向 8 位有符号整数数组的指针指示的值。 // // 参数: // value: // 一个指针,指向以 null 结尾的 8 位带符号整数数组。 // // 异常: // t:system.argumentnullexception: // value 为 null。 // // t:system.argumentexception: // 如果 value 是用 ansi 编码的,则不能使用 value 初始化 system.string 的新实例。 // // t:system.argumentoutofrangeexception: // 要初始化的新字符串的长度过大,无法分配,该长度由 value 的 null 终止字符决定。 // // t:system.accessviolationexception: // value 指定的地址无效。 [clscompliant(false)] [securitycritical] public string(sbyte* value); // // 摘要: // 将 system.string 类的新实例初始化为由指向 unicode 字符数组的指定指针指示的值。 // // 参数: // value: // 指向以 null 终止的 unicode 字符数组的指针。 // // 异常: // t:system.argumentoutofrangeexception: // 当前进程并不是对所有编址字符都有读取权限。 // // t:system.argumentexception: // value 指定了包含无效 unicode 字符的数组,或者 value 指定了小于 64000 的地址。 [clscompliant(false)] [securitycritical] public string(char* value); // // 摘要: // 将 system.string 类的新实例初始化为由重复指定次数的指定 unicode 字符指示的值。 // // 参数: // c: // 一个 unicode 字符。 // // count: // c 出现的次数。 // // 异常: // t:system.argumentoutofrangeexception: // count 小于零。 [securitysafecritical] public string(char c, int count); // // 摘要: // 将 system.string 类的新实例初始化为由 unicode 字符数组、该数组内的起始字符位置和一个长度指示的值。 // // 参数: // value: // unicode 字符的数组。 // // startindex: // value 内的起始位置。 // // length: // 要使用的 value 内的字符数。 // // 异常: // t:system.argumentnullexception: // value 为 null。 // // t:system.argumentoutofrangeexception: // startindex 或 length 小于零。- 或 -startindex 和 length 之和大于 value 中的元素数。 [securitysafecritical] public string(char[] value, int startindex, int length); // // 摘要: // 将 system.string 类的新实例初始化为由指向 8 位有符号整数数组的指定指针、该数组内的起始位置和一个长度指示的值。 // // 参数: // value: // 指向 8 位带符号整数数组的指针。 // // startindex: // value 内的起始位置。 // // length: // 要使用的 value 内的字符数。 // // 异常: // t:system.argumentnullexception: // value 为 null。 // // t:system.argumentoutofrangeexception: // startindex 或 length 小于零。- 或 -由 value + startindex 指定的地址相对于当前平台来说太大;即,地址计算溢出。- // 或 -要初始化的新字符串的长度太大,无法分配。 // // t:system.argumentexception: // 由 value + startindex 指定的地址小于 64k。- 或 -如果 value 是用 ansi 编码的,则不能使用 value 初始化 system.string // 的新实例。 // // t:system.accessviolationexception: // value、startindex 和 length 共同指定的地址无效。 [clscompliant(false)] [securitycritical] public string(sbyte* value, int startindex, int length); // // 摘要: // 将 system.string 类的新实例初始化为由指向 unicode 字符数组的指定指针、该数组内的起始字符位置和一个长度指示的值。 // // 参数: // value: // 指向 unicode 字符数组的指针。 // // startindex: // value 内的起始位置。 // // length: // 要使用的 value 内的字符数。 // // 异常: // t:system.argumentoutofrangeexception: // startindex 或 length 小于零,value + startindex 引起指针溢出,或者当前进程并不是对所有编址字符都有读取权限。 // // t:system.argumentexception: // value 指定了包含无效 unicode 字符的数组,或者 value + startindex 指定了小于 64000 的地址。 [clscompliant(false)] [securitycritical] public string(char* value, int startindex, int length); // // 摘要: // 将 system.string 类的新实例初始化为由指向 8 位有符号整数数组的指定指针、该数组内的起始位置、长度以及 system.text.encoding // 对象指示的值。 // // 参数: // value: // 指向 8 位带符号整数数组的指针。 // // startindex: // value 内的起始位置。 // // length: // 要使用的 value 内的字符数。 // // enc: // 一个对象,用于指定如何对 value 所引用的数组进行编码。如果 enc 为 null,则假定以 ansi 编码。 // // 异常: // t:system.argumentnullexception: // value 为 null。 // // t:system.argumentoutofrangeexception: // startindex 或 length 小于零。- 或 -由 value + startindex 指定的地址相对于当前平台来说太大;即,地址计算溢出。- // 或 -要初始化的新字符串的长度太大,无法分配。 // // t:system.argumentexception: // 由 value + startindex 指定的地址小于 64k。- 或 -未能使用 value 初始化 system.string 的新实例,假定 value // 按照 enc 的指定进行编码。 // // t:system.accessviolationexception: // value、startindex 和 length 共同指定的地址无效。 [clscompliant(false)] [securitycritical] public string(sbyte* value, int startindex, int length, encoding enc);
char []cstr = { 'a','b','c','d','e'}; char cstr1 = 'a'; sbyte se = 113; string a = new string(cstr); // string b = new string(&cstr1); string c = new string(&se); string d = new string('d',2); string e = new string(cstr,2,3); string f = new string(&se,0,1); console.writeline((int)convert.tochar(f)+"\n");//113 string g = new string(&se,0,1,encoding.utf8); console.writeline("a:{0}\nb:{1}\nc:{2}\nd:{3}\ne:{4}\nf:{5}\ng:{6}",a,b,c,d,e,f,g);
string a = "1234"; string b = "123"; b += "4"; console.writeline(a == b);//比较值 console.writeline((object)a == (object)b);//比较引用()
如对本文有疑问, 点击进行留言回复!!
Mobilenetv3-ssd训练VOC格式数据集loss出现nan:数据本身出现问题
Android PackageManagerService(二)下载安装详解
Asp.Net Core 3.1 Web Api 返回数据字段被转换为小驼峰格式的解决办法
已知两点经纬度,计算偏移角(正北为0,顺时针为正,逆时针为负)
解决问题“Could not load file or assembly xxxxxxx or one of its dependencies”
网友评论