001 using System; 002 using System.Collections.Generic; 003 using System.Text; 004 005 namespace DataGenericsType 006 { 007 public struct Point<T> 008 { 009 public T X; 010 public T Y; 011 } 012 013 class Program 014 { 015 static void 016 { 017 // 일반정수좌표 018 Point<int> intPoint; 019 intPoint.X = 1; 020 intPoint.Y = 2; 021 Console.WriteLine(" 022 Console.WriteLine(""); 023 024 // 부동소수점 정밀도가 필요한 차트좌표 025 Point<double> doublePoint; 026 doublePoint.X = 1.2; 027 doublePoint.Y = 3.4; 028 Console.WriteLine("부동 소수점 Point 좌표: X({0}), Y좌표({1})", doublePoint.X, doublePoint.Y); 029 Console.WriteLine(""); 030 } 031 } 032 } |
'IT > C#' 카테고리의 다른 글
C#2.0 Iterators,Partial 클래스,Nullable 타입 (0) | 2009.10.07 |
---|---|
닷넷 트랜잭션 정리 (0) | 2009.09.30 |
C#2.0 , C# 3.0 New Features (0) | 2009.09.15 |
C# 3.0 개요 (0) | 2009.09.11 |
[.net Framework] System.Activator 객체 (0) | 2009.08.24 |