C#/기초
-
[C#] 문법C#/기초 2022. 6. 29. 10:33
IEnumerable AND => 람다식 IEnumerable Names; name name name . . . name name들의 나열 public string Username => _reservation.Username; member => expression; 여기서 expression은 유효한 식 A => B A를 호출하면 B를 실행. Username을 호출하면 _reservation.Username을 불러옴 public IEnumerable Reservations => _reservations; ReservationViewModel클래스의 나열인 Reservations을 호출하면 _reservations를 불러옴. nameof nameof 식은 변수, 형식 또는 멤버의 이름을 문자열 상수로 가져..
-
-
[C#] IEnumerable vs ListC#/기초 2022. 6. 27. 15:07
C# IEnumerable vs List and Array When you should use one over the other and what I learned trying to work this out… TL;DR It depends! As is often the case with programming. IEnumerables delay execution of the query until the code is looped over or a value type is extracted. Basically IEnumerables have a method to get the next item in the collection, so they look at items “one at a time”, they do..
-
[C#]배열 초기화C#/기초 2022. 6. 15. 10:02
double[] array= Enumerable.Repeat(0, length).ToArray(); 자료형만 맞춰주면 되고 '0'에 초기화 하고 싶은 숫자. length 는 할당하고 싶은 크기. https://terrorjang.tistory.com/99 [C#] 배열 0으로 초기화(Enumerable.Repeat) 배열을 선언하면서 0또는 같은 수로 초기화 하고 싶다. 그러나 생성자에는 없는듯 하여 알아보았다. 한글로 검색하면 나오질 않더이다. 구글 검색 : Array Zero Initialize 참고 : http://stackoverflow.com/que terrorjang.tistory.com
-
-
[C#] abstract, virtual, overrideC#/기초 2022. 4. 4. 11:25
abstract : 구현하는 놈이 무조건 재 정의해서 써. 1) 메서드에 abstract을 사용하려면 해당 클래스도 abstract로 선언되어야 한다. 2) abstract 키워드로 표시한 속성이나 메서드는 본문을 정의할 수 없고, 파생된 자식클래스에서 이 메서드를 정의 할 수 있다.(반드시 정의 해야함) 3) 접근 한정자 private은 사용이 불가하다. virtual : 디폴트 값은 제공할게 필요하면 재 정의해서 써. 1) 메서드에 virtual 키워드를 붙여야한다. 2) 접근 한정자 private은 사용이 불가하다 3) abstract과 다르게 본문을 정의 할 수 있다. (괄호만 치고 비워 놓아도 됨) 4) 파생클래스에 base. 키워드를 쓰면 부모 클래스에있는 메소드에 있는 내용 실행할 수 있음 ..
-
-
[C#]Resources.resx 열기C#/기초 2022. 2. 25. 10:17
프로젝트 파일 Alt + Enter Resources -> Create or open assembly resources Resources 이미지 올리기 // // DockPanel 사용시 이미지가 패널크기에 맞추어짐 코드에서 namespace PaintHD { /// /// Interaction logic for MainWindow.xaml /// public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); //Image image = new Image(); ImageViewer1.Source = new BitmapImage(new Uri("/Resources/sg2.jpg", UriKind.RelativeO..