본문 바로가기
반응형

C#27

C# 소스코드: sealed 클래스 사용예제 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MyNamespace { sealed class Parent { } class MyClass : Parent//sealed 클래스는 상속불가 { public static void Main(string[] args) { } } } 2017/01/06 - [C#] - C# 소스코드: 가변길이 params 사용예제2017/01/01 - [C#] - C# 소스코드: 달러, 엔 환전 예제2017/01/01 - [C#] - C# 소스코드: Call By Reference,Value 인수 전달 .. 2017. 1. 6.
C# 소스코드: 가변길이 params 사용예제 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MyNamespace { class MyClass { public static float GetAvg(params float[] args)//경우에 따라 길이가 달라지는 가변길이 params { float mean = 0; for (int i = 0; i 2017. 1. 6.
C# 소스코드: 달러, 엔 환전 예제 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MyNamespace { class MyClass { public static void Exchange(float Won, out float Dollar, out float Yen) { Dollar = Won / 1200; Yen = Won / 1024; } public static void Main(string[] args) { float Won, Dollar, Yen; Won = float.Parse(Console.ReadLine()); Exchange(Won, out Dolla.. 2017. 1. 1.
C# 소스코드: Call By Reference,Value 인수 전달 방식 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MyNamespace { class MyClass { public static void Swap(ref int x, ref int y) { int temp; temp = x; x = y; y = temp; } public static void Main(string[] args) { int one = 1; int two = 2; Console.WriteLine("Before one=" + one + " two=" + two); Swap(ref one, ref two); Console... 2017. 1. 1.
반응형