일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- gitlab
- c#
- vim
- Houdini
- Data Structure
- 플러터
- C++
- dart 언어
- 다트 언어
- c# 추상 클래스
- HTML
- C# delegate
- Algorithm
- Python
- c언어
- 유니티
- c# 윈폼
- C언어 포인터
- git
- Unity
- docker
- jupyter lab
- github
- 깃
- 도커
- c# winform
- 포인터
- Flutter
- jupyter
- 구조체
Archives
- Today
- Total
05-15 13:20
목록c# 프로퍼티 초기화 (1)
nomad-programmer
[Programming/C#] 프로퍼티와 생성자
프로퍼티를 이용한 초기화는 다음과 같다. 클래스이름 인스턴스 = new 클래스이름() { 프로퍼티1 = 값, 프로퍼티2 = 값, 프로퍼티3 = 값 } 객체를 생성할 때 목록에 객체의 모든 프로퍼티가 올 필요는 없다. 초기화하고 싶은 프로퍼티만 넣어서 초기화하면 된다. 매개 변수가 있는 생성자를 작성할 때와는 달리 어떤 필드를 생성자 안에서 초기화할지를 미리 고민할 필요가 없다. using System; namespace CSharpExample { class MainApp { class BirthdayInfo { public string Name { get; set; } public DateTime Birthday { get; set; } public int Age { get { return new Da..
Programming/C#
2020. 9. 14. 00:11