惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Martin Fowler
Martin Fowler
Blog — PlanetScale
Blog — PlanetScale
Vercel News
Vercel News
L
LangChain Blog
Google DeepMind News
Google DeepMind News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
F
Fortinet All Blogs
The GitHub Blog
The GitHub Blog
Recent Announcements
Recent Announcements
D
DataBreaches.Net
云风的 BLOG
云风的 BLOG
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
A
About on SuperTechFans
博客园_首页
N
Netflix TechBlog - Medium
Y
Y Combinator Blog
Hugging Face - Blog
Hugging Face - Blog
Last Week in AI
Last Week in AI
酷 壳 – CoolShell
酷 壳 – CoolShell
B
Blog
Apple Machine Learning Research
Apple Machine Learning Research
罗磊的独立博客
美团技术团队
V
V2EX

博客园 - huadust

msdn 网络编程 委托用法 注册表操作 DateTime各种用法 [转]将dll汇入exe 用DataTable构建树 Lock Review Class Review DataTable opertion Drag DataGridView Data To TreeView 2009_01_15_星期三 2009_01_02_星期五 2008_12_31_星期三 2008_12_24_星期三 2008_12_20_星期六 2008_12_17_星期三 2008_12_06_星期六 2008_12_04_星期四
String Review
huadust · 2009-07-23 · via 博客园 - huadust

class Program
{
    
static void Main()
    {
        
string input1 = "123456";
        GetStr1(input1);
        Console.WriteLine(input1);
string input2 = "123456";
        GetStr2(
ref input2);
        Console.WriteLine(input2);
string input3 = "123456";
        GetStr3(
out input3);
        Console.WriteLine(input3);

        Console.ReadLine();
    }

static string GetStr1(string input)
    {
        input 
= "Hello";
        
return input;
    }
static string GetStr2(ref string input)
    {
        input 
= "Hello";
        
return input;
    }
static string GetStr3(out string input)
    {
        input 
= "Hello";
        
return input;
    }
}

Result is:
123456
Hello
Hello

Actual:

string input2 = null;
string input3 = null;

Result is the same.