목표: C#에서 사용하고자 하는 데이터를 class type(Struct)로 만들어 보자.

* 주의점: Main Form보다 상위에 Class를 선언하면, UI error가 발생함.

 

==============================================================================

구조체는 Value타입이고 Class Reference타입니다.

으잉? 항상 듣는 소리다. ‘ValueReference’

차이점은 이거면 충분히 알 수 있다.

int a = 10;

int b = a;

a = 20;

현재 b의 값은? 당연히 10이다. Value타입이니까

class ClassA

{

public int valTest = 0;

}

ClassA a = new ClassA();

ClassA b = a;

a.valTest = 5;

현재 b.valTest의 값은? 당연히 5. bnew ClassA();에서 생성된 메모리 번지를 가리키고 있기 때문이다. Reference니까

그럼

struct StructA

{}

StructA a = new Struct();

StructA b = a;

이건?

다시말하지만 struct Value타입이다 기억해두도록

==============================================================================

 

// This structure create the DataBase which the variables used in the this program.
public class PKGDataStructure
{
public PKGDataStructure() { }
~PKGDataStructure() { }

// TestInfo

// Summary View
public string strFilePath;

};

 

+ Recent posts