C# 기초 강의실

시삽: 레드플러스 님 
게시판 이동:
 제목 : using 지시자를 사용한 Type Definition
글번호: 354
작성자: 레드플러스
작성일: 2014/01/03 오후 7:53:00
조회수: 2830
파일: TypeDefinitionWithUsing(1).png (73 KB) / 전송수: 1354
TypeDefinitionWithUsing(1).png
//[I] 네임스페이스 추가
using System;

namespace TypeDefinitionWithUsing
{
    //[II] DevLec.Education.CSharp.Lecture 형식을 Project 별칭으로 줄여서 사용
    using Project = DevLec.Education.CSharp.Lecture;

    class Program
    {
        static void Main(string[] args)
        {
            //[1] 기본 호출
            DevLec.Education.CSharp.Lecture l = new DevLec.Education.CSharp.Lecture();
            Console.WriteLine(l);
            //[2] using 지시자 사용 호출
            Project p = new Project();
            Console.WriteLine(p);
        }
    }
}

namespace DevLec
{
    namespace Education
    {
        namespace CSharp
        {
            public class Lecture
            {
                public override string ToString()
                {
                    return "Lecture 클래스 호출됨";
                }
            }
        }
    }
}
 
이전 글   다음 글 삭제 수정 답변 글쓰기 리스트

(댓글을 남기려면 로그인이 필요합니다.)

관련 아티클 리스트
  제       목 파일 작성자 작성일 조회
이전글 C# 확장 메서드(Extension Method) ExtensionMethodDemo-Small(1).png(160 KB) 레드플러스 2014-01-03 3027
현재글 using 지시자를 사용한 Type Definition TypeDefinitionWithUsing(1).png(73 KB) 레드플러스 2014-01-03 2830
다음글 LINQ 데모: 초간단 LINQ 사용 샘플 코드 LinqDemo.png(71 KB) 레드플러스 2013-04-19 3352
 
손님 사용자 Anonymous (손님)
로그인 Home