일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- c#
- git
- 도커
- HTML
- c# 추상 클래스
- Houdini
- 다트 언어
- Algorithm
- vim
- c# winform
- github
- jupyter lab
- docker
- Flutter
- Unity
- Python
- jupyter
- 플러터
- gitlab
- c언어
- C++
- 포인터
- dart 언어
- c# 윈폼
- 깃
- C언어 포인터
- C# delegate
- 유니티
- 구조체
- Data Structure
Archives
- Today
- Total
목록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