This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lock(this); | |
lock("some string"); | |
lock(this.publicField); | |
lock(typeof(MyType)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
byte[] buffer = GetSomeBuffer(); | |
byte[] digest = SHA256.HashData(buffer); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
byte[] buffer = GetSomeBuffer(); | |
using (var sha256 = SHA256.Create()) | |
{ | |
byte[] digest = sha256.ComputeHash(buffer); | |
/* use 'digest' here */ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SearchEmployeeRequest | |
{ | |
public string Name { get; set; } | |
public int MaxResults { get; set; } | |
} | |
public class SearchProductRequest | |
{ | |
public string Name { get; set; } | |
public int MaxResults { get; set; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SearchRequest | |
{ | |
public string Name { get; set; } | |
public int MaxResults { get; set; } | |
// Product Specific Filters | |
public string Category { get; set; } | |
public int MaxPrice { get; set; } | |
public int Price { get; set; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SearchRequest | |
{ | |
public string Name { get; set; } | |
public int MaxResults { get; set; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SearchEmployeeRequest | |
{ | |
public string Name { get; set; } | |
public int MaxResults { get; set; } | |
} | |
public class SearchProductRequest | |
{ | |
public string Name { get; set; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal class LifetimeEventsHostedService : IHostedService | |
{ | |
private readonly ILogger<LifetimeEventsHostedService> _logger; | |
private readonly IHostApplicationLifetime _appLifetime; | |
private readonly TelemetryClient _telemtryClient; | |
public LifetimeEventsHostedService( | |
ILogger<LifetimeEventsHostedService> logger, | |
IHostApplicationLifetime appLifetime, | |
TelemetryClient telemtryClient) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.AspNetCore.Hosting; | |
using Microsoft.Extensions.DependencyInjection; | |
using Microsoft.Extensions.Hosting; | |
public class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
CreateHostBuilder(args).Build().Run(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task<ActionResult> GetExample([FromBody] ExampleRequest request) | |
{ | |
if (!ModelState.IsValid) | |
{ | |
// return the customized error | |
} | |
// Handle the request | |
} |
NewerOlder