- .Net 6.0
- ORM Choose (E.F., Dapper, nHibernate, LLBGenPro...)
- Web API
- Visual Studio Tools and Features
- C# Programming Features
-
- Coding Features
-
- New Features
- IDE Code Clean-up and Code Style
| ##def: | |
| private getMerchantConfigData() { | |
| return new Promise((resolve, reject) => { | |
| this.configService.get().subscribe(res => { | |
| this.merchantConfigData = res; | |
| resolve(true); | |
| }); | |
| }) | |
| } |
| public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory) | |
| { | |
| //.... | |
| app.UseCors("AllowAnyOrigin"); | |
| app.UseCors("AllowOrigin"); | |
| app.UseCors("CorsPolicy"); | |
| app.UseCors(builder => builder | |
| //.AllowAnyOrigin() | |
| .SetIsOriginAllowed(origin => true) | |
| .AllowAnyMethod() |
| public static string? Add(this string? s, int count, char add = ' ', bool before = false) | |
| => string.Create(s?.Length ?? 0, s, (span, value) => | |
| { | |
| value.AsSpan().CopyTo(span); | |
| (before ? span[..count] : span[count..]).Fill(add); | |
| }); |
| public static bool IsNullOrEmpty([NotNullWhen(false)] this string? str) => str?.Trim() is null or { Length: 0 }; |
| SELECT * | |
| FROM sys.extended_properties p | |
| JOIN sys.columns c | |
| ON p.major_id = c.object_id | |
| AND p.minor_id = c.column_id | |
| WHERE p.major_id = OBJECT_ID('<table_name>', 'table') |
| if (randomShape is Circle { Diameter: 10, Radius: < 5 and > 2, Area: <= 15 } c) | |
| { | |
| Console.WriteLine($"This is my circle. Area: {c.Area}"); | |
| } | |
| if (randomShape is not null) | |
| { | |
| } | |
| if (randomShape is not Recatngle) | |
| { |
| internal readonly record struct Person(string Name, int Age); | |
| var people = new List<Person> { new("Ali", 20), new("Reza", 30), new("Mohammad", 40) }; | |
| var behzad = people.FirstOrDefault(x => x.Name == "Behzad", new("Behzad", 37)); | |
| output: Person { Name = Behzad, Age = 37 } |
| var cts = new CancellationTokenSource(); | |
| var httpClient = new HttpClient(); | |
| var response = await httpClient.GetAsync("https://localhost:5001/downloadfile", cts.Token) | |
| .WaitAsync(TimeSpan.FromMilliseconds(4200), cts.Token); |
| name: Build main branch on push | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| build: | |
| runs-on: windows-latest |