제목 : 예제. JavaScript1.2의 location객체 모방하기
    
    
        
            
                | 글번호: |  | 249 | 
            
                | 작성자: |  | 레드플러스 | 
            
                | 작성일: |  | 2004/11/02 오후 12:56:00 | 
            
            
                | 조회수: |  | 7691 | 
            
        
     
 
    
	
	
    
	//JavaScript의 location객체 모방하기
//location.href속성, location.reload()메서드
using System;
public class location //설계도 : location 클래스
{
    //[1] 임시 저장용 필드 선언
    private static string url = String.Empty;
    //[2] href 프로퍼티 선언
    public static string href
    {
        set 
        {
            url = value;//url필드에 넘겨져온 값 대입
        }
    }
    //[3] reload() 메서드 선언
    public static void reload()
    {
        Console.WriteLine("현재 페이지를 새로고침 합니다.");
    }
}
//사용 : JavaScriptTest 클래스
public class JavaScriptTest
{
    public static void Main()
    {
        //콘솔에 "~로 이동합니다." 출력
        location.href = //쓰기전용 속성
            "http://www.dotnetkorea.com/";
        location.reload();//"새로 고침합니다."
    }
}