json轉string示例
C#String.Copy()方法 (C# String.Copy() Method)
String.Copy() method is used to copy a string to new string object, it returns a new instance of String with the same value as given string.
String.Copy()方法用于將字符串復制到新的字符串對象,它返回具有與給定字符串相同值的String的新實例。
Syntax:
句法:
public static string Copy (string str);
Parameter: string – whose value to be copied
參數: string-要復制其值的字符串
Return value: string - returns a copy of the given strong.
返回值: 字符串 -返回給定強度的副本。
Example:
例:
Input:
string str1 = "IncludeHelp";
creating new string using String.Copy() method:
string str2 = String.Copy(str1);
Output:
str1: IncludeHelp
str2: IncludeHelp
C#使用String.Copy()方法復制字符串的示例 (C# Example to copy a string using String.Copy() method)
using System;
using System.Text;
namespace Test
{
class Program
{
static void Main(string[] args)
{
string str1 = "IncludeHelp";
//creating new string using String.Copy() method
string str2 = String.Copy(str1);
//printing strings
Console.WriteLine("str1: " + str1);
Console.WriteLine("str2: " + str2);
//hit ENTER to exit
Console.ReadLine();
}
}
}
Output
輸出量
str1: IncludeHelp
str2: IncludeHelp
Reference: String.Copy(String) Method
參考: String.Copy(String)方法
翻譯自: https://www.includehelp.com/dot-net/string-copy-method-with-example-in-c-sharp.aspx
json轉string示例