보관함

csharp enum 을 사용하는 코드 샘플

출처 : https://qiita.com/mkuwan/items/be6745f2c9e7823f8a66

public static class TypeExtention { /// <summary> /// enumの値リストを取得 /// </summary> /// <typeparam name=”T”></typeparam> /// <returns></returns> public static List<T> GetEnumList<T>(this Type type) where T : Enum { return Enum.GetValues(typeof(T)).Cast<T>().ToList(); } /// <summary> /// enumのDescripntionリストを取得 /// </summary> /// <typeparam name=”T”></typeparam> /// <returns></returns> public static IEnumerable<string> GetEnumDescriptionEnumerable<T>(this Type type) where T : Enum […]

dotnet core api version

출처 : https://dotnetcoretutorials.com/2017/01/17/api-versioning-asp-net-core/

Install-Package Microsoft.AspNetCore.Mvc.Versioning

startup.cs

public void ConfigureServices(IServiceCollection services) { // ApiVersioning을 추가 services.AddApiVersioning(options => { // 클라이언트에 Api 버전을 통지 options.ReportApiVersions = true; // 이것이 없으면 클라이언트 측에서 에러가 나온다 options.AssumeDefaultVersionWhenUnspecified = true; // Api의 default 버전을 1.0으로 설정 options.DefaultApiVersion = new ApiVersion(1, 0); }); }

출처에 보면 여러가지 방식(Url Query Based […]

mac에 dotnet 환경 설정

지금까지 개발을 .net 5.0 에서 해오다가 이번에 환경을 .net 6.0 으로 바꾸면서

mac 에서는 5.0 이하 버전의 .net 은 직접 설치를 해왔다.

그러다 6.0으로 바꾸면서 brew 를 사용해서 설치가 가능한것을 확인했다.

// 일단 기존 dotnet을 remove 하기 위해 brew 로 dotnet 설치 brew install –cask dotnet brew uninstall dotnet // 6.0 설치 brew install […]