字符串程序使用C sharp [英] String program using C sharp
本文介绍了字符串程序使用C sharp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
string s1 =Old Value;
string s2 = s1;
s1 =新值;
Console.WriteLine (s2);
打印的输出是什么
我尝试过:
string s1 =Old Value;
string s2 = s1;
s1 =新值;
Console.WriteLine(s2);
输出的内容是什么
string s1 = "Old Value";
string s2 = s1;
s1 = "New Value";
Console.WriteLine(s2);
What will be the output printed
What I have tried:
string s1 = "Old Value";
string s2 = s1;
s1 = "New Value";
Console.WriteLine(s2);
What will be the output printed
推荐答案
有一种简单的方法可以知道:只需运行该代码并自己查看。
There is an easy way to know: just run that code and see by yourself.
在另一种方法中,您可以阅读文档字符串(C#编程指南)| Microsoft Docs [ ^ ](参见字符串对象的不变性部分,2 nd 示例)。
In another approach, you could read the documentation Strings (C# Programming Guide) | Microsoft Docs[^] (see the "Immutability of String Objects" sections, 2nd example).
这篇关于字符串程序使用C sharp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文