본문 바로가기
728x90
반응형

전체 글303

C#] DynamicObject Class VS ExpandoObject Class Introduction C#는 주로 statically typed language이다. 변수의 data type을 compiler가 미리 알아야 한다. 변수의 data type을 알지 못하면, compiler는 compile하지 않고, 에러를 발생시킨다. .NET 4.0에 DLR(Dynamic Language Runtime)이 추가된 이후, C#도 dynamic feature를 제공한다. System.Dynamic Namespace에는 DynamicObject Class와 ExpandoObject Class를 포함한다. Dynamic Data Type 외부 파일의 데이터를 C# code로 변환하는 경우, C#은 외부 파일 데이터의 타입을 알지 못한다. 이런 경우, dynamic type을 사용해서 com.. 2022. 7. 7.
C#] Expression trees 설명, Delegate와 차이점 출처 : https://www.tutorialsteacher.com/linq/linq-expression Expression Tree란? 코드를 정의하는 데이터 구조 expression tree의 node는 하나의 expression이다. expresstion node의 ExpressionType은 System.Linq.Expressions.ExpressionType enum으로 종류를 확인할 수 있다. lambda expression의 명확한 구조를 만든다. namespace: System.Linq.Expressions.Expression var sum = 1 + 2; 위의 코드를 tree로 만들면 아래와 같다. Variable declaration statement with assignment (va.. 2022. 7. 6.
C#] Delegates Delegate란? method signature(return type and parameters)를 정의하는 참조형식의 data type이다. 함수의 parameter로 전달될 수 있다. Delegate는 아래 3단계로 동작한다. 1. Declare a delegate, 델리게이트 선언 Delegate syntax [access modifier] delegate [return type] [delegate name]([parameters]) string parameter와 void return type을 가지는 MyDelegate라는 이름의 delegate를 선언했다. public delegate void MyDelegate(string msg); delegate는 class 내부, 외부에서 모두 선언 .. 2022. 7. 6.
C#] 코드 성능 분석 BenchmarkDotNet BenchmarkDotNet이란? 오픈소스, NuGet package로 설치할 수 있는 코드 성능 테스트 library 사용법 1. Visual Studio 2022, .NET 6 console application project(project name : NET6_Console) 생성 2. Nuget package 관리에서 BenchmarkDotNet 찾아서 설치 3. MyBenchmarks.cs 파일 추가 using BenchmarkDotNet.Attributes; using System; using System.Collections.Generic; using System.Linq; using System.Security.Cryptography; using System.Text; using Syste.. 2022. 7. 5.
C#] Anonymous Type(무명 형식) 정의, 사용법, Dynamic Type과 비교 출처 : https://code-maze.com/anonymous-types-csharp/ Anonymous Type이란? 이름이 없는 클래스레벨 참조형식이다. 형식지정 없이 object를 초기화할 수 있다. 한개 이상의 public read-only properties를 갖는다. compiler가 할당값에 따라 peroperty의 type을 결정하고, object의 name도 생성한다. 임시 데이터의 저장을 위해 주로 사용된다. object전체를 anonymous type으로 할당하는 대신, 필요한 properties만 할당할 수 있고, 이는 LINQ expression에서 유용하게 사용된다. Anonymous Type의 사용법 Anonymous Type은 var와 new keyword와 함께 obje.. 2022. 6. 28.
.NET CLI] 사용법 - 빌드, 실행, 게시(self-contained, framework-dependent) (3) .NET CLI] 사용법 - 솔루션 생성, 프로젝트 생성, 참조 추가 (2) 프로젝트 솔루션 만들기 Visual Studio를 사용하지 않고 .NET CLI를 사용해서 2개의 projects를 포함하는 solution을 생성하고 building, cleaning, running, packaging, publishing을 해보자. 가벼운 사양의 프로.. bigexecution.tistory.com 이전 게시글에 이어서 프로젝트를 빌드해보자. C:\Project\CliDemo\DemoApp>dotnet build .NET용 Microsoft (R) Build Engine 버전 17.1.1+a02f73656 Copyright (C) Microsoft Corporation. All rights reserved... 2022. 6. 24.
728x90
반응형