2009년 11월 04일
야후 퍼플 이벤트
# by | 2009/11/04 13:10 | 기타 | 트랙백 | 덧글(0)
Class 내에서 static으로 선언된 변수의 값은, 그 클래스를 여러번 호출할 경우에도 유지된다.
아래의 간단한 예제를 통해서 확인할 수 있다.
Visual C# 2008의 ConsoleApplication 응용 프로그램으로 생성되었으며,
main entry class Program() 내에서 test() 클래스를 두 번, 즉 t1, t2 를 두 번 선언하였다.
test class 내에는 static int 변수 m이 0으로 초기화 되며,
생성자가 호출될 때마다 m 값은 1씩 증가한다.
처음 t1 을 선언한 후에는 t1.m은 1이 되며, 두 번째 t2 를 선언한 후에는 t2.m은 2가 된다.
==================================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
public class test
{
static int m=0;
public int M
{ get { return m; } }
public test()
{
m++;
}
}
class Program
{
static void Main(string[] args)
{
test t1 = new test();
Console.WriteLine("t1 = {0}", t1.M);
test t2 = new test();
Console.WriteLine("t2 = {0}", t2.M);
Console.ReadKey();
}
}
}
=====================================================

# by | 2009/10/07 09:02 | 프로그래밍 | 트랙백 | 덧글(0)
# by | 2009/10/05 16:36 | 영화, 책 | 트랙백 | 덧글(0)
MS Visual Studio에서 제공하는 Chart component 이다.
Dundas chart의 이전 버전을 Microsoft에서 라이센스하여 제공한다고 하며, 무료로 사용 가능하다.
1. 사전 필요사항
- MS Visual Studio 2008 SP1 (Visual Studio 2008 C# Express, Webdeveloper 2008 에서도 사용 가능)
Microsoft .NET Framework 3.5 SP1
2. 설치 파일
MSChart.exe
MSChart_VisualStudioAddOn.exe
DataVisChartControl.zip DataVisChartControl.z01
WebSamples.zip
WinSamples.zip WinSamples.z01 WinSamples.z02 WinSamples.z03
3. 설치방법
1) MSChart.exe 실행
2) MSChart_VisualStudioAddOn.exe 실행
3) VisualStudio 실행 후, 컨트롤을 도구 상자에 등록
- 도구상자에 마우스를 갖다 대고, 오른쪽 메뉴에서 "항목 선택"을 클릭한다.



# by | 2009/10/01 13:57 | 프로그래밍 | 트랙백 | 덧글(0)
C#에서 class를 배열로 선언하여 사용할 경우에는,
아래 예제와 같이 배열 선언시에 new 키워드를 선언하고, 다시 한번 개별 요소마다 new 선언을 해 주어야 한다.
========================================================================================
class Lens
{
int diameter;
public Lens(int dia) // 생성자
{
diameter = dia;
}
}
class Camera
{
Lens[] lens; // Lens 클래스의 배열 선언
public Camera(int nLens) // Camera 클래스 생성자, 예제로 Class 생성자가 nLens라는 값을 초기 변수를 갖는다고 가정
{
lens = new Lens[nLens]; // lens 변수에 5개의 Class 메모리 할당
for (int i=0; i<nLens; i++)
lens[i] = new Lens(3.0); // 개별 lens 요소에 Lens 클래스 초기화 선언 (diameter=3.0 으로 초기화)
}
}
==================================================================
# by | 2009/09/30 14:00 | 프로그래밍 | 트랙백 | 덧글(0)
◀ 이전 페이지 다음 페이지 ▶