.NET 10 OpenAPI 기본 지원과 Swagger UI·Scalar 설치 및 설정 방법
ASP.NET Core .NET 10에서 OpenAPI는 기본 지원되지만 Swagger UI는 별도 설치가 필요합니다. VS Code 프로젝트 생성, AddOpenApi/MapOpenApi, Swagger UI와 Scalar 설정, TypeLoadException 해결 방법을 예제로 설명합니다.
ASP.NET Core .NET 10에서 OpenAPI는 기본 지원되지만 Swagger UI는 별도 설치가 필요합니다. VS Code 프로젝트 생성, AddOpenApi/MapOpenApi, Swagger UI와 Scalar 설정, TypeLoadException 해결 방법을 예제로 설명합니다.
예제1 예제2 추가 중요 포인트 (실무 핵심) 1️⃣ XML 깨짐 방지 (매우 중요) SecurityElement.Escape(message) 👉 안 하면 이런 문제 발생: 2️⃣ InnerException이 항상 더 중요한가? 👉 꼭 그렇지 않음 예: 👉 상황에 따라 둘 다 필요할 수도 있음 🔥 실무용 (추천 로그 스타일) ✅ 결론 방식 안전성 추천 ex.InnerException.Message ❌ 위험 (null 가능) ❌ ex.Message… Read More »
C#에서 Math.Pow는 거듭제곱(제곱 연산) 을 하는 함수입니다. 65600 / 100 = 656.00 반환형은 double 그래서 decimal 계산할 때는 반드시 캐스팅 필요: 🔬 내부 동작 원리 Math.Pow(10, 3) 은 내부적으로 10 × 10 × 10 을 계산해서 1000 반환 하지만 double 기반 계산이라 1000.0000000000001 같은 미세 오차가 있을 수 있습니다. Sample
Overview : 원인과 해결 소스를 받고 소스를 열어 보면 위와 같이 참조가 모드 느낌표로 나온다. 원인 : dll 위치가 컴 마다 다르기 때문 해결 : 오류가 나더라도, 컴파일 하면 소스에서 가까운 위치에서 Dll 을 찾기 하여 하나씩 풀린다. – 풀리지 않는 DLL 은 프로그램을 닫고 다시 열면 찾아진다ㅏ. 마지막으로 찾지 못하는 DLL 은 수동으로 찾아준다.
1. 모든 파라미터를 전송하지 않아도 에러가 발생하지 않도록 설정하는 방법 ✅ 방법 1: Nullable 타입 사용 파라미터를 nullable (int?, double?, DateTime?, string 등)로 설정하면, 클라이언트가 값을 보내지 않아도 에러 없이 처리됩니다. 위 예제에서: ✅ 방법 2: SOAP 헤더 또는 JSON 바인딩 활용 만약 REST API와 유사하게 일부 데이터만 선택적으로 보내고 싶다면, JSON을 활용하는 것이 좋습니다.… Read More »
Overview : 2000만개 자연수중 소수 찾기 속도 사용법 : Sample :
Remark : Scintilla 오픈 소스 Net에서 사용하기 1.Nuget에서 패키지 다운로드 2.Net Demo 다운로드 3.Net Demo 실행화면
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
DateTime dt = new DateTime(2008, 3, 9, 16, 5, 7, 123); String.Format("{0:y yy yyy yyyy}", dt); // "8 08 008 2008" year String.Format("{0:M MM MMM MMMM}", dt); // "3 03 Mar March" month String.Format("{0:d dd ddd dddd}", dt); // "9 09 Sun Sunday" day String.Format("{0:h hh H HH}", dt); // "4 04 16 16" hour 12/24 String.Format("{0:m mm}", dt); // "5 05" minute String.Format("{0:s ss}", dt); // "7 07" second String.Format("{0:f ff fff ffff}", dt); // "1 12 123 1230" sec.fraction String.Format("{0:F FF FFF FFFF}", dt); // "1 12 123 123" without zeroes String.Format("{0:t tt}", dt); // "P PM" A.M. or P.M. String.Format("{0:z zz zzz}", dt); // "-6 -06 -06:00" time zone |
|
1 2 3 4 |
String.Format("{0:d/M/yyyy HH:mm:ss}", dt); // "9/3/2008 16:05:07" - english (en-US) String.Format("{0:d/M/yyyy HH:mm:ss}", dt); // "9.3.2008 16:05:07" - german (de-DE) |
|
1 2 3 4 5 6 7 8 9 10 11 12 |
tring.Format("{0:M/d/yyyy}", dt); // "3/9/2008" String.Format("{0:MM/dd/yyyy}", dt); // "03/09/2008" // day/month names String.Format("{0:ddd, MMM d, yyyy}", dt); // "Sun, Mar 9, 2008" String.Format("{0:dddd, MMMM d, yyyy}", dt); // "Sunday, March 9, 2008" // two/four digit year String.Format("{0:MM/dd/yy}", dt); // "03/09/08" String.Format("{0:MM/dd/yyyy}", dt); // "03/09/2008" |
Standard DateTime Formatting In DateTimeFormatInfo there are defined standard patterns for the current culture. For example property ShortTimePattern is string that contains value h:mm tt for en-US culture and value HH:mm for de-DE culture. Following table shows patterns defined in DateTimeFormatInfo and their values for en-US culture. First column contains format specifiers… Read More »
|
1 2 3 4 5 6 7 8 9 10 11 12 |
LINQ to entities query // Descending SearchFareInfoList = SearchFareInfoList.OrderByDescending(o => o.NoShowFee).ToList(); // Contain : True False SegmentOrder = AirSegmentData.Select(o => o.Key).Contains(SegmentRef).ToString(); // 있으면 값 가져오기 if (AirSegmentData.Select(s => s.Key).Contains(SegmentRef).ToString() == "True") SegmentOrder = AirSegmentData.Single(s => s.Key == SegmentRef).SegmentOrder; |
추천 : ToUniversalTime using System.Linq; using System.Text; using System.Collections.ObjectModel; namespace ConsoleTime { class Program { static void Main(string[] args) { DateTime thisDate = new DateTime(2007, 3, 10, 0, 0, 0); DateTime dstDate = new DateTime(2007, 6, 10, 0, 0, 0); DateTimeOffset thisTime; thisTime = new DateTimeOffset(dstDate, new TimeSpan(-7, 0, 0)); ShowPossibleTimeZones(thisTime); thisTime = new DateTimeOffset(thisDate,… Read More »