Common Type System n Value Type Reference Type
- Slides: 59
Common Type System n Value Type & Reference Type n Value Type(값형) n int a = 10; int b = a; a = a + 10; n a=>20, b=>10 n n n a[10] Reference Type(참조형) n My. Class A = new My. Class(); a[10] b[10] a[10+10 ] b[10] 스택(stack) A a[20] b[10] 힙(Heap) [0 x 000500…] Myclass 힙 영역 메모리주소 n My. Class B = A; A [0 x 000500…] B [0 x 000500…] Myclass
Common Type System n 내장형(Built-In Type)& 사용자정의형(User-Defined Type) 값형 (Value Type) 내장형 사용자정의형 (Built-In Type) (User-Defined Type) -데이터형: int, float 등 -데이터형: enum, struct등
C# 기본 데이터형 1. 정수형 �� �위 sbyte 8 �� -128 ~ 127 short ushort 16 �� -32, 768 ~ 32, 767 0 ~ 65, 535 int uint 32 �� -2, 147, 483, 648 ~ 2, 147, 483, 647 0 ~ 4, 294, 967, 295 64 �� 9223372036854775808~9223372036854775807 0~18, 446, 744, 073, 709, 551, 615 long ulong § § 0 ~ 255 형 이름 앞에 "s"가 붙은 것은 “signed”를 나타내며 부호를 가 진 숫자형으로 음수와 양수를 표현하겠다는 의미 "u"가 붙은 것은 “unsigned”를 나타내며 부호 없이 양수만 표 현
사용자 정의 데이터형 n 구조체 using System; struct Person // Point 구조체 정의 { public string Name; public int Age; } class Test { static void Main() { Person you; // 구조체 선언 you. Name = "gocsharp"; // 멤버 사용 you. Age = 1; Console. Write. Line("{0}, {1}", you. Name, you. Age ); } }
사용자 정의 데이터형 n 이넘(enum) using System; class Test { // enum 형 상수 선언 public enum Color { Red, Green, Blue }; // 0, 1, 2 public static void Main() { // 변수 선언 Color color = Color. Green; if ( color == Color. Green ) Console. Write. Line( "Green 입니다. " ); } }
배열 n Array 객체 n Sort 메서드는 배열이 가지고 있는 요소 값을 정렬해서 다시 재배 열 // 배열 선언 string [] arr = { "zoo", "bear", "cat", "apple" } // 배열 정렬 Array. Sort( arr ); for( int i=0; i< arr. Length; i++ ) { Console. Write. Line( “{0}", arr[i] ); // apple, bear, cat, zoo }
제어문 n switch 문 n 키보드로부터 숫자를 입력받아 메시지를 출력하는 예제 public static void Main() { Console. Write. Line("숫자를 선택하세요. (1~3) : "); string s = Console. Read. Line(); int n = int. Parse(s); // 문자열을 숫자로 변환 switch( n ) { case 1: Console. Write. Line("one 선택 "); break; case 2: Console. Write. Line("two 선택 "); break; case 3: Console. Write. Line("three 선택"); break; } } default: Console. Write. Line("선택 항목에 없습니다. "); break;
- Reference type and value type
- Penciptaan nilai adalah
- Reference node and non reference node
- Reference node and non reference node
- Find the common multiples of 12 and 18
- Common anode and common cathode
- Factors of 60 and 72
- Factors of 54
- Factors of 12 and 42
- Highest common factors and lowest common multiples
- International place value system in maths
- Valrox
- P value fomula
- D value and z value
- Saponification value calculator
- Future value of $1
- Relative value vs absolute value
- How to find expected value of a spinner
- How to find expected values
- Anthropocentrism vs ecocentrism
- Value creation and value capture
- Java reference type
- Best bible cross reference system
- Rps reference point system
- Vdatum noaa
- Dect system architecture reference model
- Nga innovision
- Reference of interconnection
- Clock reference system
- Reference model of real time system
- How high up do clouds form
- What does structure fits function mean
- Most common blood type for caucasian
- What is this called
- Which is the most common type of precipitation?
- Types of irony practice
- Synthetic fiber definition forensics
- The most common type of bullying
- Closed open and isolated systems
- Site:slidetodoc.com
- Caterpillar common rail fuel system
- Which of the following few common services provided by os
- Give 9 most common parts of a securement system
- Common sense examples
- Design metrics of embedded system
- Accumulator logic in computer architecture
- Fabavb
- Convert 703 octal to hexadecimal
- Avionics architecture
- International submarine engineering
- Healthcare common procedure coding system
- Claim and counterclaim example
- Ecommerce payment system
- Self reliant soft ecologist
- Do you capitalize job titles
- Technocentric perspective
- What is a marketing channel system and value network
- Absolute value system of equations
- American value system
- Environmental value systems