본문 바로가기

Software/C#.Net

Understanding C# Arrays MSDN C# Array Initialization Syntax Initialization of C# Array .... // Array initialization syntax using the new keyword. string[] stringArray = new string[] { "one", "two", "three" }; Console.WriteLine("stringArray has {0} elements", stringArray.Length); // Array initialization syntax without using the new keyword. bool[] boolArray = { false, false, true }; Console.WriteLine("boolArray has {0} .. 더보기
LINQ Line4 int[] numbers = { 10, 20, 30, 40, 1, 2, 3, 8 }; // LINQ query! var subset = from i in numbers where i < 10 select i; Console.Write("Values in subset: "); foreach (var i in subset) { Console.Write("{0} ", i); } Console.WriteLine(); 더보기
System Data Types and C# Shorthand Notation CLS-compliant .NET code can be used by any managed programming language. If you expose non–CLS-compliant data from your programs, other languages may not be able to make use of it The Data Type Class Hierarchy Notice that each of these types ultimately derive from System.Object, which defines a set of methods (e.g., ToString(), Equals(), GetHashCode()) common to all types in the .NET base class .. 더보기
The System.Console Class MSDN Most of methods are static WriteLine() pumps a text strings including a carriage return to the output stream Write() method pumps text to the output stream without a carriage return ReadLine() allows you to receive information from the input stream up until the Enter key is pressed Read() used to capture a single character from the input stream .NET Numerical Format Characters -------------.. 더보기
Processing Command-Line Arguments for Loop version static int Main(string[] args) { ... // Process any incoming args. for(int i = 0; i < args.Length; i++) Console.WriteLine("Arg: {0}", args[i]) Console.ReadLine(); return -1; } Foreach Version // Notice you have no need to check the size of the array when using "foreach". static int Main(string[] args) { ... // Process any incoming args using foreach. foreach(string arg in args) .. 더보기
Specifying Command-Line Arguments with Visual Studio 2010 더보기
The Assembly/Namespace/Type Distinction the .NET platform makes extensive use of the namespace concept A namespace is a grouping of semantically related types contained in an assembly 더보기
The CLR, CTS, CLS, and base class library relationship(.Net4.0) Using different compiler, but creates same IL files Benefits of CIL language integration - all languages are able to interact within a well-defined binary arena platform-agnostic, - the .NET Framework itself is platform-agnostic The Role of the Assembly Manifest metadata describes the assembly itself the assembly’s version number copyright information 더보기
[C#]Enumerable Type만들기 (IEnumerable과 IEnumerator) 먼저 다음코드를 보자 int[] myInt = {10,20,30,40}; foreach(int i in myInt) { Console.WriteLine(i); } 여기서 myInt즉, int 타입이 GetEnumerator()합수를 지원하기 때문에 foreach구문이 가능하다. 즉, foreach를 사용하려면, 무조건 GetEnumerator()를 지원해야 만 쓸 수 있다. 얘를 들어 다음과 같은 클래스가 있다면, public class Car { private int currSpeed; private string petName; public int Speed { get { return currSpeed; } set { currSpeed = value; } } public string PetName { .. 더보기
[C#]benefit of Generic vs nonGeneric Generic은 boxing/unboxing 과정에서 생기는 성능을 향상시킨다 Generic은 type에 보다 안전적이다 custom collection type 생성을 줄여준다 더보기