際際滷

際際滷Share a Scribd company logo
惡悋悋慍惆悽惘惆  悴悋
愕 惡惘悋c#
愕惆惠惘悴 悋悴惆 悋 惆忰 : 擯惘惆悛惘惆 
惡悽愆愆愆
ref , out
amjadima@gmail.com
愆愆 惡悽愆愕 惡惘悋C#1
)悋擯慍悋擧 悴悋惡 悋 悋擯慍 (悴悋惡 悴悋惡 惡忰惓 惡  悽惡refout. 惘愕惆
. 悋惘悴悋惺 悋 悋惆 惆悋惘 悋 擯惠 惠愃惘悋  擯惠 惘悋 惠愃惘悋 悋悋惺  惆 惡悽愆 惆惘
惆悋:  悋 惘int,double,bool,enum,struct
:  悋 悋惘悴悋惺string,class,Array
: 悋 悋惘悴悋惺惡 悋慍 惺惆ref:
1.悛惘悋 惺悋惶惘 惠擧 惠擧 惆悋惘  擯惘惠 惘悋 悛惘悋 擧 擧 惡愕 惠惆 悽悋   擧  愆惘惺 悋 悋惘悴悋惺 悋慍 悋惡惠惆悋  悽惡
: 惡擯惘惆 惘惆 悋慍
using System;
namespace Test_1
{
class Program
{
static int[] GetArray(int[] GetArray_A)
{
for(int i = 0 ; i < GetArray_A.Length;i++)
{
Console.Write("F_Array[{0}] : ",i);
GetArray_A[i] = Convert.ToInt32(Console.ReadLine());
}
return GetArray_A;
}
static void Main()
{
int[] Main_a1 = new int[5];
GetArray(Main_a1);
Console.ReadKey();
}
}
}
悋 悛悋  悽惡 擧惆  擧悋惘 惆惘愕惠 擧惆
擧惆  擧悋惘 惆惘愕惠 惡  悽惡
 悋愕惠 惡 悋惡 惡愕惆 悋惠悋 惠惘  悋惠忰悋 惡惘悋 惘悋 擧惆  悋擯惘 悛悋
惆擯 擧  擧悋惘 惆悋惘 惆惘愕惠  惡悋愆 惡 悋惡 惘悋
. 惆悋惘 悋惘悋惆 擧 擧惆 悋   
蛇 惡悋愆惆 悋惘悴悋惺 惆悋惆 擧 惺 悋慍 惠愃惘 擧 惠  擧  惡悋 悴惆惆 惘悋 悋 擯惠 擧悋愕 愕惘 擧 惘悋 悋 擧惠 悋惡 悛惘悋
惘惆 悛惘擯悋 悴悋愆 擧 惠愃惘  惆惆 惠愃惘 惘悋 惘惆 悛惘擯悋 悛 惆悋悽 惺悋惶惘  悋惺惷悋 惠惆   擧 拆悋愕 惠惆
. 擧惆  惠愃惘 慍  愆惆  惠惆
悋悴悋 惆惘悛惘悋Main_a1悛惘悋 )(悴悋擯慍 悴悋愆GetArray_A惠惆 惘惆 悛惘擯悋 擧GetArray. 愆惆  悋愕惠
惠惆GetArray悛惘悋 悋惺惷悋 惠擧 惠擧 惡GetArray_A悛惘悋 擧 擯惠 惠悋 ( 悋惆 惆悋惘 悋 悛惘悋 愀惘 悋慍  惆惆  惆悋惘 惆悋惘惆
GetArray_A悛惘悋 惡惘悋 惆擯惘 悋Main_a1)惡悋愆惆 悛惘悋 擧 惠 拆愕GetArray_A惠惆 惆悋悽F惆惘  愆惆  惆 惆悋惘
悛惘悋 惆悋惘 悋惺Main_a1惆悋悽 擧Main. 擧  惆 惆悋惘 惘悋 悋愕惠 愆惆 惠惺惘
愆愆 惡悽愆愕 惡惘悋C#2
悋擯惘 拆愕Main: 惆悋惘惆 惘悋 惴惘 惘惆 惠悴  擧惆  擧悋惘 惆惘愕惠 擧惆 惡悋慍  惆 惠愃惘 慍惘 惡惶惘惠 惘悋
static void Main()
{
int[] Main_a1 = new int[5];
GetArray(Main_a1);
Console.ReadKey();
}
惠惆 擯惘  悽惡GetArray惘悋 惘惆 悛惘悋 悋return擧惆 惡 悽惡 
悛惘悋 悽惘悴  惆悋惘 悋慍 悛 悽惘悴 惡  拆愕void擧 悛惘悋 擧 悋擯惘 愀惘 悋慍   擧 new拆悋愕 惠惆 悋 惡 惡悋愆惆 愆惆
 擧惆  擧悋惘 惆惘愕惠 惠惆 悛悋  愆惆
擧 悋 悛惘悋   悽惘new惆悋惘 悋愕惠 愆惆null惆悋惘 擧 惠愃惘 惡惘悋  惆悋惘惆null悛 悋 愆悽惶 悋慍 惠悋  惆悋惘
拆惘悋拆惘惠 悋慍 惠悋  惆惘悋悴悋 ( 惆 悋愕惠悋惆Length惡 惡惘愕惆  惆 悋愕惠悋惆 悛 悋惆擧愕惘 悋慍 惠悋    惆 悋愕惠悋惆 悛
悋擯惘 愆擧 悋 惘惺 惡惘悋  愆惆 悽悋 悋悴 悋悴惘悋 忰 惆惘 悽愀悋 惡悋 拆愕 )惡惆 惆悋惘 惆悋惘惆 悴惆 擧 惺惶惘  惺惷 惡 悋擧
惠惆 惘惆 悛惘悋null 惡悋愆惆擧 拆愕  愆惆 悋悴惘悋 惡悋惆 惠惆 悋 悽愀 悋慍 擧 擧 擧 悋愕惠 悋return: 擯悵悋愆惠
using System;
namespace Test_1
{
class Program
{
static void GetArray(int[] GetArray_A)
{
if (GetArray_A == null)
return;
for(int i = 0 ; i < GetArray_A.Length;i++)
{
Console.Write("F_Array[{0}] : ",i);
GetArray_A[i] = Convert.ToInt32(Console.ReadLine());
}
}
static void Main()
{
int[] Main_a1 = new int[5];
GetArray(Main_a1);
Console.ReadKey();
}
}
}
愆愆 惡悽愆愕 惡惘悋C#3
! 惘惠 愆惆 忰惘  悋愕惠 悋愀惘 惘悋 擧 惡惡 忰悋
惆悋悽 擧 惆悋惘 悛惘悋 惆惠悋  惓悋 惆惘 擧惆  悋愆悋惘 忰悋惴 惆惘 悛 悵悽惘 愆惘惺 悛惆惘愕 惡 悋惘悴悋惺 悋 惆悋惆 惺 惠愃惘Main
惠惆 惆悋悽 惆擯惘GetArray悛惘悋 Main_a1( 擧悋拆惠惘 悋惶 忰悋惴 悋慍 悋 悽悋 惡RAM悛惘悋 擧 惠  擧惆  悋愆悋惘 )
Main_a1惠惆 惡 惘悋GetArray悛惘悋  擧  拆悋愕Main_a1悛惘悋 惡GetArray_A悛惘悋    愆惆  惆悋惆 愕惡惠
悛惘悋 愆惘惺 悛惆惘愕 惆悋惘 拆愕 )悛 愆惘惺 悛惆惘愕 惡 愕惠惆(悋惘悴悋惺 悋惘悴悋惺 悋Main_a1悛惘悋 愆惘惺 悛惆惘愕 惡 惘悋GetArray_A
: 惆  愕惡惠
惆悋悽 悛惘悋 悋惠愕悋惡  惠惆 惘悋悽悋 悋慍 惡Main惠惆 悛惘擯悋 惡惠惆 惘悋悽悋 悋慍 惡惺惆愆惆  擧 惆悋 悛惘悋 惆 :
惆悋悽 悛惘悋 惠惆 惆悋悽 悛惘悋  愆惆  愆悋惆 擧 愀惘 悋 拆愕Main惺悋惶惘  惠惆 惆悋悽 擧 惠 拆愕  愆惆  擧 惆悋
惆悋悽 悛惘悋 惆悋惘 悋惺 惆惘  擧 惘惠惡 惘悋 悛惘悋 悋 惡惆 惆悋惘 惘悋 悛惘悋Main惆 惆悋惘 慍 惘悋 )愆惆  拆悋愕 惠惆 惡 擧 悋 (悛惘悋
擧  惘惠惡 悋 擧 惠惆 惆惘 惘悋 忰悋惶 擧 愕惠 悋慍  return. 擧
2.惡惘悋 惠悋  惘悋  愆悋惡 惆悋class: 愆惠)擯惘惆  惘悋惘 惡惘惘愕 惘惆 惡惺惆 悋 惡悽愆 惆惘 悋 (擧悋愕
惡悋 擧悋愕 擧 悋惡惠惆悋 惆惘Student惆悋惘悋 擧愆  悽悋悋惆擯 悋  悋 惆 惠惺惘 悋愕惠 惆悋愆悴 悋惘悽悋  忰悋
擧 惡愕 惠惆student惘悋惘悋 惆悋愆悴 擧惡擯惘惆悛惘悋(悋 惆悋 )惆悋愆悴 愆悋惘  悽悋悋惆擯 悋擧悋惘惡惘 悋慍
惡擯惘惆惠惆  : 愆惠 惆悋愆悴 悋愀悋惺悋惠 悋拆 惡惘悋 惆擯惘
using System;
namespace Test_1
{
class Program
{
class Student
{
public string Name; public string Family; public string Id;
}
static void ReadStudent(Student s)
{
if (s == null)
return;
Console.Write("Name : ");
s.Name = Console.ReadLine();
Console.Write("Family : ");
s.Family = Console.ReadLine();
Console.Write("Id : ");
s.Id = Console.ReadLine();
}
static void WriteStudent(Student s)
{
Main_a1
GetArray_A = null
Main_a1
GetArray_A
愆愆 惡悽愆愕 惡惘悋C#4
if (s == null)
return;
Console.WriteLine("Name : {0}", s.Name);
Console.WriteLine("Family : {0}",s.Family);
Console.WriteLine("Id : {0}",s.Id);
}
static void Main()
{
Student s1 = new Student();
ReadStudent(s1);
WriteStudent(s1);
Console.ReadKey();
}
}
}
愆惆 擯惠 擧 愀惘 悋class擧 惠惆 擧 擧 惠  悋愕惠 悋惘悴悋惺 悛惘悋 悋惆Student惆悋 惡  惡擯惘惆 惘悋
惆悋愆  惆惆 惆悋惘 悛惆悋悽 擧 悴Main惆悋愆悴 惡悋  愆惆  拆悋愕 惴惘 惘惆 惠惆 惡  )惆擯惘 惘悴悋 愆惆(悋 惠惺惘
惆悋悽 惆悋愆悴 惆悋 惠惘惠惡 悋 惡  愆惆  擧 惠惆 惆悋悽Main. 愆惆  惆 惆悋惘
擧悋愕 悽惆 惆悋悽 惘悋 惠惆悋 惠悋 Student: 愆惠
using System;
namespace Test_1
{
class Program
{
class Student
{
public string Name; public string Family; public string Id;
public static void ReadStudent(Student s)
{
if (s == null)
return;
Console.Write("Name : ");
s.Name = Console.ReadLine();
Console.Write("Family : ");
s.Family = Console.ReadLine();
Console.Write("Id : ");
s.Id = Console.ReadLine();
}
public static void WriteStudent(Student s)
{
if (s == null)
return;
Console.WriteLine("Name : {0}", s.Name);
Console.WriteLine("Family : {0}", s.Family);
Console.WriteLine("Id : {0}", s.Id);
}
}
static void Main()
{
Student s1 = new Student();
Student.ReadStudent(s1);
Student.WriteStudent(s1);
Console.ReadKey();
}
}
}
愆愆 惡悽愆愕 惡惘悋C#5
: 悋 悋惘悴悋惺惡 悋慍ref:
忰悋悋悋 惠悋 (拆愕 ! 擧 愆惘惺 惘 惡忰惓 惠悋慍 悽悋 悴悋)!!!悽惘  !!  惆擯 擯惠 拆惘惠  惘惠 愆
擧悋愕 悋Student( 悋悴悋惆 惘悋 惆悋愆悴 擧 擧 惡愕 惠惆 悽悋   悋 愆惠 惘悋 悋new惆悋惘 悛惘悋 惆悋 愕拆愕  )
愕  悋悴 擧   愕 悋  擧惆 惆!!!: 愆惠 悋 愆悋 拆愕 
using System;
namespace Test_1
{
class Program
{
class Student
{
public string Name; public string Family; public string Id;
public static void CreateReadStudent(Student s)
{
if (s == null)
return;
s = new Student();
Console.Write("Name : ");
s.Name = Console.ReadLine();
Console.Write("Family : ");
s.Family = Console.ReadLine();
Console.Write("Id : ");
s.Id = Console.ReadLine();
}
public static void WriteStudent(Student s)
{
if (s == null)
return;
Console.WriteLine("Name : {0}", s.Name);
Console.WriteLine("Family : {0}", s.Family);
Console.WriteLine("Id : {0}", s.Id);
}
}
static void Main()
{
Student s1 = new Student();
Student.CreateReadStudent(s1);
Student.WriteStudent(s1);
Console.ReadKey();
}
}
}
: 擯惆  擧惆 悋悴惘悋 惘悋 惡惘悋 擧 忰悋悋"惡悋 悋惡悋"悋Visual Studio悋擧惘愕悋惠 !!! 擧 悽惘悋惡 
悋悋 !!!!!! 擧 悴愆 惡惘 惡悋惆 惆擯!!!! 悋惘 擧惘惆 愕悽惘
 惡惺惆愆)擧 悽惆悋 (悋惡惠 ! 愕惘惠 惠 慍 !!!!!!! 悴惆 惆悋惆 惠惷忰  悋惆 擯
愆愆 惡悽愆愕 惡惘悋C#6
)擧 愆 惡悋惡悋 擯 悋擧 悋慍 (悴惆悋 悋惠  悋惠悋  惡惡 忰悋
惆惘惆悋悽 擧 惠 悋惡惠惆悋Main惆悋愆悴 s1惘悋new: 惆悋惘 擧 
惆悋愆悴 愆悋惘
悽悋悋惆擯 悋
悋
惆悋愆悴 擧 惠 忰悋s1惆悋悽Main(惆悋愆悴 惠惆 惆悋悽 惆悋愆悴 惡 惘悋s悋愕惠 擧悋愕 擧 惆悋愆悴   惆  愕惡惠 )
惆悋愆悴 愆惘惺 悛惆惘愕 惆悋惘  )忰悋惴 惆惘 愆惘惺 悛惆惘愕 惡 惡惆(悋惘悴悋惺 悋惘悴悋惺 s1惆悋愆悴 愆惘惺 悛惆惘愕 惡 惘悋s忰悋惴 惆惘
惆悋愆悴 惆 惺悋 拆愕 惆  愕惡惠ss1: 惆悋惘 拆愕  )惆悋愆悴 擧 惡 (惘惡愀 惡惆 擧
惆悋愆悴 愆悋惘
悽悋悋惆擯 悋
悋
惆悋愆悴  擧悋惘 愆 ! 擧  擧悋惘  惆悋惘 惠惆 惆悋悽 悋 忰悋s惘悋new擧 
惺擯惘 悋慍 惠 擧 惡悋愆惆 忰悋愕惠悋new: 惆悋惘 拆愕  愆惆 悽悋惆 悋悴悋 忰悋惴 惠悽惶惶 惺悋惠  擧  悋愕惠悋惆
惆悋愆悴 愆悋惘
悽悋悋惆擯 悋
悋
惆悋愆悴 愆悋惘
悽悋悋惆擯 悋
悋
悋慍 拆愕 愆惆  愆悋惆 愀惘擧 悋new惆悋愆悴 愆惆s惆擯惘  惠惆 惆悋悽s1s 悴慍悋惆悋惘惆 惆擯 惡 惘惡愀  愆惆 
惆悋 惡 惆悋惘 悋 惠惆 惆悋悽 s惡 惘惡愀  擧 惆  惆悋惘s1. 惆悋惘惆
s1
s = null
s1
s
s1
s
愆愆 惡悽愆愕 惡惘悋C#7
悋慍 惡悋惆 愆擧 悋 忰 惡惘悋ref慍惡悋 惆惘 拆惠惘 悋惆 擧 擧 悋愕惠悋惆c: 惡悋愆惆 
using System;
namespace Test_1
{
class Program
{
class Student
{
public string Name; public string Family; public string Id;
public static void CreateReadStudent(ref Student s)
{
if (s == null)
s = new Student();
Console.Write("Name : ");
s.Name = Console.ReadLine();
Console.Write("Family : ");
s.Family = Console.ReadLine();
Console.Write("Id : ");
s.Id = Console.ReadLine();
}
public static void WriteStudent(Student s)
{
if (s == null)
return;
Console.WriteLine("Name : {0}", s.Name);
Console.WriteLine("Family : {0}", s.Family);
Console.WriteLine("Id : {0}", s.Id);
}
}
static void Main()
{
Student s1 = null;
Student.CreateReadStudent(ref s1);
Student.WriteStudent(s1);
Console.ReadKey();
}
}
}
! 愆惆 愆愀  愆惆  悋悛  悽惡
悋慍 擧 忰悋ref惡 惘惡愀 擧 忰悋惴 悋慍 悴悋 悛惆惘愕 悛惆惘愕  擧  悋愕惠悋惆s1忰悋惴 擧 悴悋 悛惆惘愕 悛惆惘愕 惡  悋愕惠s悋愕惠
拆愕  愆惆  惆悋惆 愕惡惠ss1. 愆惆  忰 愆擧  愆惆  擧
擧悋愕 愕惘 擧 悋 惓悋 愕悋惘! 擧 惠惡  忰惠惘 惆悋愆悴 愆悋 忰惠  惡悽悋惆 忰惠悋 慍 惘悋  悋惆 愆惆 愆惠
: 惆悋惘 悋 惆悋惆 惺
擧  擧悋惘 惆悋惘 惠愃惘悋 惡悋 惠 擧 惡悋愆惆 惆悋愆惠 惠悴 愀   悋 惓悋 悋惆 慍 悋 惆悋惘 悋 惆悋惆 惺 惡惘悋
 擧  擧悋惘 悛悋 惆悋惘 惡悋 惠惆 悋擧 惡惘悋  悋Swap悋慍 惡悋惆 惡愕 ... ref. 擧 悋愕惠悋惆
愆愆 惡悽愆愕 惡惘悋C#8
惺惆惆 擧 惡愕 悽悋  惠惆 : 惓悋n 擯惘惠 惘悋n悋: 愕  悽惡  悋惆 悛 悴悋擯慍 惘悋 惘惆 惺惆惆 
using System;
namespace Test_1
{
class Program
{
static void F(int n)
{
n = 2 * n - 1;
}
static void Main()
{
int n1 = 5;
F(n1);
Console.WriteLine(n1);
Console.ReadKey();
}
}
}
忰悋  擧惆  擧悋惘 惆惘愕惠 擧 惡  惠悴 惠愕惠 惺 悋悋 ! 悋惠惆  悋惠悋  
惆悋惘n1惡惘悋惡惘 悋惡惠惆悋 惆惘5擧 惠  惡惆n1惠惆 惡 惘悋F 拆悋愕 悛惘悋 惆悋惘 愀  愀 惆悋惘 悋惺 惆惘  擧  拆悋愕
惆悋惘 拆愕  擧n惠惆 惆悋悽F慍5: 愆惆 
5
5
擧 惡  拆愕n1n悛惆惘愕 惡悋惆 愆擧 悋 忰 惡惘悋  擧惆擯惘惆 悋慍 悴慍悋n1悛惆惘愕 惡 惘悋n惆 惘 惠悋 惆 愕惡惠
: 愆惆 擧
using System;
namespace Test_1
{
class Program
{
static void F(ref int n)
{
n = 2 * n - 1;
}
static void Main()
{
int n1 = 5;
F(ref n1);
Console.WriteLine(n1);
Console.ReadKey();
}
}
}
惠惆 擧 惠   愆惆  忰 愆擧 惠惘惠惡 惡惆 拆愕F悛惆惘愕  擧  惘悋悽悋 惘悋n1 擧  拆悋愕 惠惆 悋 惡 惘悋
悛惆惘愕n1惘悛惘惆愕 惡 悋n惠悴 惆惘  惆  愕惡惠n1n悋惺 惆惘 拆愕  愆惆  擧愕悋 悋 悛惆惘愕 惆悋惘悋n1n
惡 惠惆 惆悋悽 擧 惠  愆惆  擧n惡 惆悋惘 悋惺 惆惘  惡惆 惆悋惘n1惆悋悽 擧Main. 惆  惆悋惘 悋愕惠
n1
n
愆愆 惡悽愆愕 惡惘悋C#9
撃惠惆 悋慍  愆惆 悋悴惘悋 擧惆悋愆 愆惆(惠悋 惠悋 惠惆 擧 擧 惠 惠悴愆 悽悋惘悴惠愃惘悋 惠悋 )(悴慍 惘惆  惡 悋慍 悛悧悋惠
惡忰惓 惡 惘惡愀 惡愆惠惘Garbage Callector)愆惆 悽悋惆 悛愆悋 悛 惡悋 擧 擯惘悋 愆 惆惘 悋愆悋悋 擧 愆惆 
ref. 擧惆  悋悋 惘悋 悛惆惘愕  拆惠惘 愆 :
惡惠悋惆 惠惆  擧 拆悋愕 惠惆 惡 惆悋惘愆 惡悋 惘悋 惘悋 惠愃惘 擧 擧 悋愕惠 悋 惡惘悋. 惆惆 惠愃惘 惘悋 惠愃惘 悋 惆悋惘
out:擧惆  悋悋 惘悋 悛惆惘愕  拆惠惘 愆.
惡惆  惠惆 悽惘悴 慍 惡return愆惆 惆 惆悋惘 惠惆 惆悋悽 惡悋惆 忰惠悋   惡悋愆惆 .
悋慍  惡惘擯惘惆悋惆 惘悋 惠悴 惆 惡悋惆 惠惆 擧 擧 惠out擧  悋愕惠悋惆.
悋慍 惆out惡擯惘惆 惆悋惘 惠惆 惆惘 悛惘擯悋 擧 悋愕惠 悋.
out惆悋惘惆 惠惆 惆惘 惆悋惘 慍  悋愕惠 愆惆 惠惺惘 惠悋慍 擧 悋愕惠 惠愃惘 悋惆  惆悋惘惆 悽惘悴 愆.
!! 惆悋惘 惘惡愀  惡 ! 惆惆 擧悋愕 !惆悋惘惆 悴慍   惡悽惆 忰惠悋 惘悋 愕惘擧悋愕 愆惆 擯惠 悋 惓悋
擧 擧 惡愕惆 惠惆 惓悋惠忰 惡惘 悛惘悋 惺惆惆 惆悋惘   悋 愕惠 惺惆惆 惘愆惠  惘愆惠 悋擧  惺惆惆 惘愆惠 惺擧愕  擯惘惠 惘愆惠
: 惆惆
using System;
namespace Test_1
{
class Program
{
static void F(string s ,out string Inv , out bool IsNumber ,out Int64 Number)
{
Inv = "";
IsNumber = true;
Number = 0;
for(int i = 0 ; i < s.Length ; i++)
{
Inv += s[s.Length - 1 - i ];
if (s[i] < '0' || s[i] > '9')
IsNumber = false;
if(IsNumber)
{
Number = (Number * 10) + (s[i] - '0');
}
}
}
static void Main()
{
string s1 = "Mohammd Amin Amjadi";
string s2;
bool b;
Int64 n;
F(s1, out s2, out b, out n);
Console.WriteLine(s1);
Console.WriteLine(s2);
Console.WriteLine(b);
Console.WriteLine(n);
Console.WriteLine("----------------------");
s1 = "12598743659";
F(s1, out s2, out b, out n);
Console.WriteLine(s1);
愆愆 惡悽愆愕 惡惘悋C#11
Console.WriteLine(s2);
Console.WriteLine(b);
Console.WriteLine(n);
Console.ReadKey();
}
}
}
惺擧愕 惘惆 惘愆惠 悋擧 悋  悋 擯  惺擧愕(惠 惘悋 惆惘悋惠 惘愆惠 悋 悽悋  擧 惠悋惠 悋 惡悋 惡悋悋 惓悋 悋 忰悋
悋慍 惡悋惆 悋慍 惶惘惠 惆惘 愆惆ref惘惆 惘愆惠 擧悋惘悋擧惠惘悋 惠悋 愆惆 擧擧 忰悋惶   ) 悋愕惠 悋慍 悋悴悋 擧  擧 悋愕惠悋惆
: 悋惆 忰悋愕惡 慍 惘悋
using System;
namespace Test_1
{
class Program
{
static void F(ref string s,out string LowString , out bool IsNumber ,out Int64 Number)
{
string Inv = "";
LowString = "";
IsNumber = true;
Number = 0;
for(int i = 0 ; i < s.Length ; i++)
{
Inv += s[s.Length - 1 - i ];
if (s[i] >= 'A' && s[i] <= 'Z')
LowString += (char)(s[i] + 'a' - 'A');
else
LowString += s[i];
if (s[i] < '0' || s[i] > '9')
IsNumber = false;
if(IsNumber)
{
Number = (Number * 10) + (s[i] - '0');
}
}
s = Inv;
}
static void Main()
{
string s1 = "Mohammd Amin Amjadi";
string s2;
bool b;
Int64 n;
Console.WriteLine(s1);
F(ref s1, out s2, out b, out n);
Console.WriteLine(s1);
Console.WriteLine(s2);
Console.WriteLine(b);
Console.WriteLine(n);
Console.WriteLine("----------------------");
s1 = "12598743659";
F(ref s1, out s2, out b, out n);
Console.WriteLine(s1);
Console.WriteLine(s2);
Console.WriteLine(b);
Console.WriteLine(n);
Console.ReadKey();
}
}
}

More Related Content

Amjadi - Ebook 6 - Ref,Out - v1

  • 1. 惡悋悋慍惆悽惘惆 悴悋 愕 惡惘悋c# 愕惆惠惘悴 悋悴惆 悋 惆忰 : 擯惘惆悛惘惆 惡悽愆愆愆 ref , out amjadima@gmail.com
  • 2. 愆愆 惡悽愆愕 惡惘悋C#1 )悋擯慍悋擧 悴悋惡 悋 悋擯慍 (悴悋惡 悴悋惡 惡忰惓 惡 悽惡refout. 惘愕惆 . 悋惘悴悋惺 悋 悋惆 惆悋惘 悋 擯惠 惠愃惘悋 擯惠 惘悋 惠愃惘悋 悋悋惺 惆 惡悽愆 惆惘 惆悋: 悋 惘int,double,bool,enum,struct : 悋 悋惘悴悋惺string,class,Array : 悋 悋惘悴悋惺惡 悋慍 惺惆ref: 1.悛惘悋 惺悋惶惘 惠擧 惠擧 惆悋惘 擯惘惠 惘悋 悛惘悋 擧 擧 惡愕 惠惆 悽悋 擧 愆惘惺 悋 悋惘悴悋惺 悋慍 悋惡惠惆悋 悽惡 : 惡擯惘惆 惘惆 悋慍 using System; namespace Test_1 { class Program { static int[] GetArray(int[] GetArray_A) { for(int i = 0 ; i < GetArray_A.Length;i++) { Console.Write("F_Array[{0}] : ",i); GetArray_A[i] = Convert.ToInt32(Console.ReadLine()); } return GetArray_A; } static void Main() { int[] Main_a1 = new int[5]; GetArray(Main_a1); Console.ReadKey(); } } } 悋 悛悋 悽惡 擧惆 擧悋惘 惆惘愕惠 擧惆 擧惆 擧悋惘 惆惘愕惠 惡 悽惡 悋愕惠 惡 悋惡 惡愕惆 悋惠悋 惠惘 悋惠忰悋 惡惘悋 惘悋 擧惆 悋擯惘 悛悋 惆擯 擧 擧悋惘 惆悋惘 惆惘愕惠 惡悋愆 惡 悋惡 惘悋 . 惆悋惘 悋惘悋惆 擧 擧惆 悋 蛇 惡悋愆惆 悋惘悴悋惺 惆悋惆 擧 惺 悋慍 惠愃惘 擧 惠 擧 惡悋 悴惆惆 惘悋 悋 擯惠 擧悋愕 愕惘 擧 惘悋 悋 擧惠 悋惡 悛惘悋 惘惆 悛惘擯悋 悴悋愆 擧 惠愃惘 惆惆 惠愃惘 惘悋 惘惆 悛惘擯悋 悛 惆悋悽 惺悋惶惘 悋惺惷悋 惠惆 擧 拆悋愕 惠惆 . 擧惆 惠愃惘 慍 愆惆 惠惆 悋悴悋 惆惘悛惘悋Main_a1悛惘悋 )(悴悋擯慍 悴悋愆GetArray_A惠惆 惘惆 悛惘擯悋 擧GetArray. 愆惆 悋愕惠 惠惆GetArray悛惘悋 悋惺惷悋 惠擧 惠擧 惡GetArray_A悛惘悋 擧 擯惠 惠悋 ( 悋惆 惆悋惘 悋 悛惘悋 愀惘 悋慍 惆惆 惆悋惘 惆悋惘惆 GetArray_A悛惘悋 惡惘悋 惆擯惘 悋Main_a1)惡悋愆惆 悛惘悋 擧 惠 拆愕GetArray_A惠惆 惆悋悽F惆惘 愆惆 惆 惆悋惘 悛惘悋 惆悋惘 悋惺Main_a1惆悋悽 擧Main. 擧 惆 惆悋惘 惘悋 悋愕惠 愆惆 惠惺惘
  • 3. 愆愆 惡悽愆愕 惡惘悋C#2 悋擯惘 拆愕Main: 惆悋惘惆 惘悋 惴惘 惘惆 惠悴 擧惆 擧悋惘 惆惘愕惠 擧惆 惡悋慍 惆 惠愃惘 慍惘 惡惶惘惠 惘悋 static void Main() { int[] Main_a1 = new int[5]; GetArray(Main_a1); Console.ReadKey(); } 惠惆 擯惘 悽惡GetArray惘悋 惘惆 悛惘悋 悋return擧惆 惡 悽惡 悛惘悋 悽惘悴 惆悋惘 悋慍 悛 悽惘悴 惡 拆愕void擧 悛惘悋 擧 悋擯惘 愀惘 悋慍 擧 new拆悋愕 惠惆 悋 惡 惡悋愆惆 愆惆 擧惆 擧悋惘 惆惘愕惠 惠惆 悛悋 愆惆 擧 悋 悛惘悋 悽惘new惆悋惘 悋愕惠 愆惆null惆悋惘 擧 惠愃惘 惡惘悋 惆悋惘惆null悛 悋 愆悽惶 悋慍 惠悋 惆悋惘 拆惘悋拆惘惠 悋慍 惠悋 惆惘悋悴悋 ( 惆 悋愕惠悋惆Length惡 惡惘愕惆 惆 悋愕惠悋惆 悛 悋惆擧愕惘 悋慍 惠悋 惆 悋愕惠悋惆 悛 悋擯惘 愆擧 悋 惘惺 惡惘悋 愆惆 悽悋 悋悴 悋悴惘悋 忰 惆惘 悽愀悋 惡悋 拆愕 )惡惆 惆悋惘 惆悋惘惆 悴惆 擧 惺惶惘 惺惷 惡 悋擧 惠惆 惘惆 悛惘悋null 惡悋愆惆擧 拆愕 愆惆 悋悴惘悋 惡悋惆 惠惆 悋 悽愀 悋慍 擧 擧 擧 悋愕惠 悋return: 擯悵悋愆惠 using System; namespace Test_1 { class Program { static void GetArray(int[] GetArray_A) { if (GetArray_A == null) return; for(int i = 0 ; i < GetArray_A.Length;i++) { Console.Write("F_Array[{0}] : ",i); GetArray_A[i] = Convert.ToInt32(Console.ReadLine()); } } static void Main() { int[] Main_a1 = new int[5]; GetArray(Main_a1); Console.ReadKey(); } } }
  • 4. 愆愆 惡悽愆愕 惡惘悋C#3 ! 惘惠 愆惆 忰惘 悋愕惠 悋愀惘 惘悋 擧 惡惡 忰悋 惆悋悽 擧 惆悋惘 悛惘悋 惆惠悋 惓悋 惆惘 擧惆 悋愆悋惘 忰悋惴 惆惘 悛 悵悽惘 愆惘惺 悛惆惘愕 惡 悋惘悴悋惺 悋 惆悋惆 惺 惠愃惘Main 惠惆 惆悋悽 惆擯惘GetArray悛惘悋 Main_a1( 擧悋拆惠惘 悋惶 忰悋惴 悋慍 悋 悽悋 惡RAM悛惘悋 擧 惠 擧惆 悋愆悋惘 ) Main_a1惠惆 惡 惘悋GetArray悛惘悋 擧 拆悋愕Main_a1悛惘悋 惡GetArray_A悛惘悋 愆惆 惆悋惆 愕惡惠 悛惘悋 愆惘惺 悛惆惘愕 惆悋惘 拆愕 )悛 愆惘惺 悛惆惘愕 惡 愕惠惆(悋惘悴悋惺 悋惘悴悋惺 悋Main_a1悛惘悋 愆惘惺 悛惆惘愕 惡 惘悋GetArray_A : 惆 愕惡惠 惆悋悽 悛惘悋 悋惠愕悋惡 惠惆 惘悋悽悋 悋慍 惡Main惠惆 悛惘擯悋 惡惠惆 惘悋悽悋 悋慍 惡惺惆愆惆 擧 惆悋 悛惘悋 惆 : 惆悋悽 悛惘悋 惠惆 惆悋悽 悛惘悋 愆惆 愆悋惆 擧 愀惘 悋 拆愕Main惺悋惶惘 惠惆 惆悋悽 擧 惠 拆愕 愆惆 擧 惆悋 惆悋悽 悛惘悋 惆悋惘 悋惺 惆惘 擧 惘惠惡 惘悋 悛惘悋 悋 惡惆 惆悋惘 惘悋 悛惘悋Main惆 惆悋惘 慍 惘悋 )愆惆 拆悋愕 惠惆 惡 擧 悋 (悛惘悋 擧 惘惠惡 悋 擧 惠惆 惆惘 惘悋 忰悋惶 擧 愕惠 悋慍 return. 擧 2.惡惘悋 惠悋 惘悋 愆悋惡 惆悋class: 愆惠)擯惘惆 惘悋惘 惡惘惘愕 惘惆 惡惺惆 悋 惡悽愆 惆惘 悋 (擧悋愕 惡悋 擧悋愕 擧 悋惡惠惆悋 惆惘Student惆悋惘悋 擧愆 悽悋悋惆擯 悋 悋 惆 惠惺惘 悋愕惠 惆悋愆悴 悋惘悽悋 忰悋 擧 惡愕 惠惆student惘悋惘悋 惆悋愆悴 擧惡擯惘惆悛惘悋(悋 惆悋 )惆悋愆悴 愆悋惘 悽悋悋惆擯 悋擧悋惘惡惘 悋慍 惡擯惘惆惠惆 : 愆惠 惆悋愆悴 悋愀悋惺悋惠 悋拆 惡惘悋 惆擯惘 using System; namespace Test_1 { class Program { class Student { public string Name; public string Family; public string Id; } static void ReadStudent(Student s) { if (s == null) return; Console.Write("Name : "); s.Name = Console.ReadLine(); Console.Write("Family : "); s.Family = Console.ReadLine(); Console.Write("Id : "); s.Id = Console.ReadLine(); } static void WriteStudent(Student s) { Main_a1 GetArray_A = null Main_a1 GetArray_A
  • 5. 愆愆 惡悽愆愕 惡惘悋C#4 if (s == null) return; Console.WriteLine("Name : {0}", s.Name); Console.WriteLine("Family : {0}",s.Family); Console.WriteLine("Id : {0}",s.Id); } static void Main() { Student s1 = new Student(); ReadStudent(s1); WriteStudent(s1); Console.ReadKey(); } } } 愆惆 擯惠 擧 愀惘 悋class擧 惠惆 擧 擧 惠 悋愕惠 悋惘悴悋惺 悛惘悋 悋惆Student惆悋 惡 惡擯惘惆 惘悋 惆悋愆 惆惆 惆悋惘 悛惆悋悽 擧 悴Main惆悋愆悴 惡悋 愆惆 拆悋愕 惴惘 惘惆 惠惆 惡 )惆擯惘 惘悴悋 愆惆(悋 惠惺惘 惆悋悽 惆悋愆悴 惆悋 惠惘惠惡 悋 惡 愆惆 擧 惠惆 惆悋悽Main. 愆惆 惆 惆悋惘 擧悋愕 悽惆 惆悋悽 惘悋 惠惆悋 惠悋 Student: 愆惠 using System; namespace Test_1 { class Program { class Student { public string Name; public string Family; public string Id; public static void ReadStudent(Student s) { if (s == null) return; Console.Write("Name : "); s.Name = Console.ReadLine(); Console.Write("Family : "); s.Family = Console.ReadLine(); Console.Write("Id : "); s.Id = Console.ReadLine(); } public static void WriteStudent(Student s) { if (s == null) return; Console.WriteLine("Name : {0}", s.Name); Console.WriteLine("Family : {0}", s.Family); Console.WriteLine("Id : {0}", s.Id); } } static void Main() { Student s1 = new Student(); Student.ReadStudent(s1); Student.WriteStudent(s1); Console.ReadKey(); } } }
  • 6. 愆愆 惡悽愆愕 惡惘悋C#5 : 悋 悋惘悴悋惺惡 悋慍ref: 忰悋悋悋 惠悋 (拆愕 ! 擧 愆惘惺 惘 惡忰惓 惠悋慍 悽悋 悴悋)!!!悽惘 !! 惆擯 擯惠 拆惘惠 惘惠 愆 擧悋愕 悋Student( 悋悴悋惆 惘悋 惆悋愆悴 擧 擧 惡愕 惠惆 悽悋 悋 愆惠 惘悋 悋new惆悋惘 悛惘悋 惆悋 愕拆愕 ) 愕 悋悴 擧 愕 悋 擧惆 惆!!!: 愆惠 悋 愆悋 拆愕 using System; namespace Test_1 { class Program { class Student { public string Name; public string Family; public string Id; public static void CreateReadStudent(Student s) { if (s == null) return; s = new Student(); Console.Write("Name : "); s.Name = Console.ReadLine(); Console.Write("Family : "); s.Family = Console.ReadLine(); Console.Write("Id : "); s.Id = Console.ReadLine(); } public static void WriteStudent(Student s) { if (s == null) return; Console.WriteLine("Name : {0}", s.Name); Console.WriteLine("Family : {0}", s.Family); Console.WriteLine("Id : {0}", s.Id); } } static void Main() { Student s1 = new Student(); Student.CreateReadStudent(s1); Student.WriteStudent(s1); Console.ReadKey(); } } } : 擯惆 擧惆 悋悴惘悋 惘悋 惡惘悋 擧 忰悋悋"惡悋 悋惡悋"悋Visual Studio悋擧惘愕悋惠 !!! 擧 悽惘悋惡 悋悋 !!!!!! 擧 悴愆 惡惘 惡悋惆 惆擯!!!! 悋惘 擧惘惆 愕悽惘 惡惺惆愆)擧 悽惆悋 (悋惡惠 ! 愕惘惠 惠 慍 !!!!!!! 悴惆 惆悋惆 惠惷忰 悋惆 擯
  • 7. 愆愆 惡悽愆愕 惡惘悋C#6 )擧 愆 惡悋惡悋 擯 悋擧 悋慍 (悴惆悋 悋惠 悋惠悋 惡惡 忰悋 惆惘惆悋悽 擧 惠 悋惡惠惆悋Main惆悋愆悴 s1惘悋new: 惆悋惘 擧 惆悋愆悴 愆悋惘 悽悋悋惆擯 悋 悋 惆悋愆悴 擧 惠 忰悋s1惆悋悽Main(惆悋愆悴 惠惆 惆悋悽 惆悋愆悴 惡 惘悋s悋愕惠 擧悋愕 擧 惆悋愆悴 惆 愕惡惠 ) 惆悋愆悴 愆惘惺 悛惆惘愕 惆悋惘 )忰悋惴 惆惘 愆惘惺 悛惆惘愕 惡 惡惆(悋惘悴悋惺 悋惘悴悋惺 s1惆悋愆悴 愆惘惺 悛惆惘愕 惡 惘悋s忰悋惴 惆惘 惆悋愆悴 惆 惺悋 拆愕 惆 愕惡惠ss1: 惆悋惘 拆愕 )惆悋愆悴 擧 惡 (惘惡愀 惡惆 擧 惆悋愆悴 愆悋惘 悽悋悋惆擯 悋 悋 惆悋愆悴 擧悋惘 愆 ! 擧 擧悋惘 惆悋惘 惠惆 惆悋悽 悋 忰悋s惘悋new擧 惺擯惘 悋慍 惠 擧 惡悋愆惆 忰悋愕惠悋new: 惆悋惘 拆愕 愆惆 悽悋惆 悋悴悋 忰悋惴 惠悽惶惶 惺悋惠 擧 悋愕惠悋惆 惆悋愆悴 愆悋惘 悽悋悋惆擯 悋 悋 惆悋愆悴 愆悋惘 悽悋悋惆擯 悋 悋 悋慍 拆愕 愆惆 愆悋惆 愀惘擧 悋new惆悋愆悴 愆惆s惆擯惘 惠惆 惆悋悽s1s 悴慍悋惆悋惘惆 惆擯 惡 惘惡愀 愆惆 惆悋 惡 惆悋惘 悋 惠惆 惆悋悽 s惡 惘惡愀 擧 惆 惆悋惘s1. 惆悋惘惆 s1 s = null s1 s s1 s
  • 8. 愆愆 惡悽愆愕 惡惘悋C#7 悋慍 惡悋惆 愆擧 悋 忰 惡惘悋ref慍惡悋 惆惘 拆惠惘 悋惆 擧 擧 悋愕惠悋惆c: 惡悋愆惆 using System; namespace Test_1 { class Program { class Student { public string Name; public string Family; public string Id; public static void CreateReadStudent(ref Student s) { if (s == null) s = new Student(); Console.Write("Name : "); s.Name = Console.ReadLine(); Console.Write("Family : "); s.Family = Console.ReadLine(); Console.Write("Id : "); s.Id = Console.ReadLine(); } public static void WriteStudent(Student s) { if (s == null) return; Console.WriteLine("Name : {0}", s.Name); Console.WriteLine("Family : {0}", s.Family); Console.WriteLine("Id : {0}", s.Id); } } static void Main() { Student s1 = null; Student.CreateReadStudent(ref s1); Student.WriteStudent(s1); Console.ReadKey(); } } } ! 愆惆 愆愀 愆惆 悋悛 悽惡 悋慍 擧 忰悋ref惡 惘惡愀 擧 忰悋惴 悋慍 悴悋 悛惆惘愕 悛惆惘愕 擧 悋愕惠悋惆s1忰悋惴 擧 悴悋 悛惆惘愕 悛惆惘愕 惡 悋愕惠s悋愕惠 拆愕 愆惆 惆悋惆 愕惡惠ss1. 愆惆 忰 愆擧 愆惆 擧 擧悋愕 愕惘 擧 悋 惓悋 愕悋惘! 擧 惠惡 忰惠惘 惆悋愆悴 愆悋 忰惠 惡悽悋惆 忰惠悋 慍 惘悋 悋惆 愆惆 愆惠 : 惆悋惘 悋 惆悋惆 惺 擧 擧悋惘 惆悋惘 惠愃惘悋 惡悋 惠 擧 惡悋愆惆 惆悋愆惠 惠悴 愀 悋 惓悋 悋惆 慍 悋 惆悋惘 悋 惆悋惆 惺 惡惘悋 擧 擧悋惘 悛悋 惆悋惘 惡悋 惠惆 悋擧 惡惘悋 悋Swap悋慍 惡悋惆 惡愕 ... ref. 擧 悋愕惠悋惆
  • 9. 愆愆 惡悽愆愕 惡惘悋C#8 惺惆惆 擧 惡愕 悽悋 惠惆 : 惓悋n 擯惘惠 惘悋n悋: 愕 悽惡 悋惆 悛 悴悋擯慍 惘悋 惘惆 惺惆惆 using System; namespace Test_1 { class Program { static void F(int n) { n = 2 * n - 1; } static void Main() { int n1 = 5; F(n1); Console.WriteLine(n1); Console.ReadKey(); } } } 忰悋 擧惆 擧悋惘 惆惘愕惠 擧 惡 惠悴 惠愕惠 惺 悋悋 ! 悋惠惆 悋惠悋 惆悋惘n1惡惘悋惡惘 悋惡惠惆悋 惆惘5擧 惠 惡惆n1惠惆 惡 惘悋F 拆悋愕 悛惘悋 惆悋惘 愀 愀 惆悋惘 悋惺 惆惘 擧 拆悋愕 惆悋惘 拆愕 擧n惠惆 惆悋悽F慍5: 愆惆 5 5 擧 惡 拆愕n1n悛惆惘愕 惡悋惆 愆擧 悋 忰 惡惘悋 擧惆擯惘惆 悋慍 悴慍悋n1悛惆惘愕 惡 惘悋n惆 惘 惠悋 惆 愕惡惠 : 愆惆 擧 using System; namespace Test_1 { class Program { static void F(ref int n) { n = 2 * n - 1; } static void Main() { int n1 = 5; F(ref n1); Console.WriteLine(n1); Console.ReadKey(); } } } 惠惆 擧 惠 愆惆 忰 愆擧 惠惘惠惡 惡惆 拆愕F悛惆惘愕 擧 惘悋悽悋 惘悋n1 擧 拆悋愕 惠惆 悋 惡 惘悋 悛惆惘愕n1惘悛惘惆愕 惡 悋n惠悴 惆惘 惆 愕惡惠n1n悋惺 惆惘 拆愕 愆惆 擧愕悋 悋 悛惆惘愕 惆悋惘悋n1n 惡 惠惆 惆悋悽 擧 惠 愆惆 擧n惡 惆悋惘 悋惺 惆惘 惡惆 惆悋惘n1惆悋悽 擧Main. 惆 惆悋惘 悋愕惠 n1 n
  • 10. 愆愆 惡悽愆愕 惡惘悋C#9 撃惠惆 悋慍 愆惆 悋悴惘悋 擧惆悋愆 愆惆(惠悋 惠悋 惠惆 擧 擧 惠 惠悴愆 悽悋惘悴惠愃惘悋 惠悋 )(悴慍 惘惆 惡 悋慍 悛悧悋惠 惡忰惓 惡 惘惡愀 惡愆惠惘Garbage Callector)愆惆 悽悋惆 悛愆悋 悛 惡悋 擧 擯惘悋 愆 惆惘 悋愆悋悋 擧 愆惆 ref. 擧惆 悋悋 惘悋 悛惆惘愕 拆惠惘 愆 : 惡惠悋惆 惠惆 擧 拆悋愕 惠惆 惡 惆悋惘愆 惡悋 惘悋 惘悋 惠愃惘 擧 擧 悋愕惠 悋 惡惘悋. 惆惆 惠愃惘 惘悋 惠愃惘 悋 惆悋惘 out:擧惆 悋悋 惘悋 悛惆惘愕 拆惠惘 愆. 惡惆 惠惆 悽惘悴 慍 惡return愆惆 惆 惆悋惘 惠惆 惆悋悽 惡悋惆 忰惠悋 惡悋愆惆 . 悋慍 惡惘擯惘惆悋惆 惘悋 惠悴 惆 惡悋惆 惠惆 擧 擧 惠out擧 悋愕惠悋惆. 悋慍 惆out惡擯惘惆 惆悋惘 惠惆 惆惘 悛惘擯悋 擧 悋愕惠 悋. out惆悋惘惆 惠惆 惆惘 惆悋惘 慍 悋愕惠 愆惆 惠惺惘 惠悋慍 擧 悋愕惠 惠愃惘 悋惆 惆悋惘惆 悽惘悴 愆. !! 惆悋惘 惘惡愀 惡 ! 惆惆 擧悋愕 !惆悋惘惆 悴慍 惡悽惆 忰惠悋 惘悋 愕惘擧悋愕 愆惆 擯惠 悋 惓悋 擧 擧 惡愕惆 惠惆 惓悋惠忰 惡惘 悛惘悋 惺惆惆 惆悋惘 悋 愕惠 惺惆惆 惘愆惠 惘愆惠 悋擧 惺惆惆 惘愆惠 惺擧愕 擯惘惠 惘愆惠 : 惆惆 using System; namespace Test_1 { class Program { static void F(string s ,out string Inv , out bool IsNumber ,out Int64 Number) { Inv = ""; IsNumber = true; Number = 0; for(int i = 0 ; i < s.Length ; i++) { Inv += s[s.Length - 1 - i ]; if (s[i] < '0' || s[i] > '9') IsNumber = false; if(IsNumber) { Number = (Number * 10) + (s[i] - '0'); } } } static void Main() { string s1 = "Mohammd Amin Amjadi"; string s2; bool b; Int64 n; F(s1, out s2, out b, out n); Console.WriteLine(s1); Console.WriteLine(s2); Console.WriteLine(b); Console.WriteLine(n); Console.WriteLine("----------------------"); s1 = "12598743659"; F(s1, out s2, out b, out n); Console.WriteLine(s1);
  • 11. 愆愆 惡悽愆愕 惡惘悋C#11 Console.WriteLine(s2); Console.WriteLine(b); Console.WriteLine(n); Console.ReadKey(); } } } 惺擧愕 惘惆 惘愆惠 悋擧 悋 悋 擯 惺擧愕(惠 惘悋 惆惘悋惠 惘愆惠 悋 悽悋 擧 惠悋惠 悋 惡悋 惡悋悋 惓悋 悋 忰悋 悋慍 惡悋惆 悋慍 惶惘惠 惆惘 愆惆ref惘惆 惘愆惠 擧悋惘悋擧惠惘悋 惠悋 愆惆 擧擧 忰悋惶 ) 悋愕惠 悋慍 悋悴悋 擧 擧 悋愕惠悋惆 : 悋惆 忰悋愕惡 慍 惘悋 using System; namespace Test_1 { class Program { static void F(ref string s,out string LowString , out bool IsNumber ,out Int64 Number) { string Inv = ""; LowString = ""; IsNumber = true; Number = 0; for(int i = 0 ; i < s.Length ; i++) { Inv += s[s.Length - 1 - i ]; if (s[i] >= 'A' && s[i] <= 'Z') LowString += (char)(s[i] + 'a' - 'A'); else LowString += s[i]; if (s[i] < '0' || s[i] > '9') IsNumber = false; if(IsNumber) { Number = (Number * 10) + (s[i] - '0'); } } s = Inv; } static void Main() { string s1 = "Mohammd Amin Amjadi"; string s2; bool b; Int64 n; Console.WriteLine(s1); F(ref s1, out s2, out b, out n); Console.WriteLine(s1); Console.WriteLine(s2); Console.WriteLine(b); Console.WriteLine(n); Console.WriteLine("----------------------"); s1 = "12598743659"; F(ref s1, out s2, out b, out n); Console.WriteLine(s1); Console.WriteLine(s2); Console.WriteLine(b); Console.WriteLine(n); Console.ReadKey(); } } }