요긴한 Tag

2011. 8. 1. 12:54
요즘 C#에 대한 맛보기 공부를 하고 있는데 C#에도 Tag Property가 있었다. Tag Property 는 Delphi 나 C++ Builder를 다룰 때 요긴하게 사용하던 것으로 Delphi나 C++ Builder 에서는 32비트 int 형으로 선언되어 있어 정수형 자료와 포인터를 저장하고 관리할 수 있었다.
실제로 Tag Property 에 대해서  VCL 문서상에서도 아래와 같이 개발자를 위해 제공하는 것으로 명시되어 있다.

Stores an integer value as part of a component.
Tag has no predefined meaning. The Tag property is provided for the convenience of developers. It can be used for storing an additional integer value or it can be typecast to any 32-bit value such as a component reference or a pointer.
Classes.TComponent.Tag
http://docwiki.embarcadero.com/VCL/en/Classes.TComponent.Tag

C#을 보면서 Tag에 대한 존재를 확인하였다.
C#의 언어적 특성때문인지 C#에서는 Tag가 Object로 선언 되어 있었다. C#의 Object에서 파생되는 모든 것을 담을 수 있다. 그래서 문자열도 쉽게 저장할 수 있다. VCL 의 Tag 보다 확장된 것이다.

Any type derived from the Object class can be assigned to this property. If the Tag property is set through the Windows Forms designer, only text can be assigned.

A common use for the Tag property is to store data that is closely associated with the control. For example, if you have a control that displays information about a customer, you might store a DataSet that contains the customer's order history in that control's Tag property so the data can be accessed quickly.

Control.Tag Property 
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.tag.aspx


Posted by NeoDreamer
:
BLOG main image
사람의 발목을 잡는건 '절망'이 아니라 '체념'이고 앞으로 나아가게 하는건 '희망'이 아니라 '의지'다. - 암스 중에서 - by NeoDreamer

공지사항

카테고리

전체보기 (793)
Life Story (1)
Thinking (2)
Nothing (5)
---------------* (0)
Dev Story (701)
Com. Story (80)
IT Story (1)
---------------+ (0)
Etc (2)

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

Total :
Today : Yesterday :
04-29 06:07