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

推荐订阅源

MongoDB | Blog
MongoDB | Blog
J
Java Code Geeks
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
D
DataBreaches.Net
腾讯CDC
GbyAI
GbyAI
I
InfoQ
博客园 - Franky
G
Google Developers Blog
Last Week in AI
Last Week in AI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
V
Visual Studio Blog
Vercel News
Vercel News
博客园_首页
MyScale Blog
MyScale Blog
Martin Fowler
Martin Fowler
N
Netflix TechBlog - Medium
V
V2EX
T
The Blog of Author Tim Ferriss
M
MIT News - Artificial intelligence
雷峰网
雷峰网
H
Hackread – Cybersecurity News, Data Breaches, AI and More
大猫的无限游戏
大猫的无限游戏
The GitHub Blog
The GitHub Blog

博客园 - 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.