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 static string UsingSpanBase64BinaryGuid(Guid oid, params string[] input) | |
{ | |
var totalUtf8Bytes = _guidSize; | |
for (int i = 0; i < input.Length; i++) | |
{ | |
totalUtf8Bytes += Encoding.UTF8.GetByteCount(input[i]); | |
} | |
Span<byte> resultSpan = stackalloc byte[Base64.GetMaxEncodedToUtf8Length(totalUtf8Bytes)]; | |
if (!MemoryMarshal.TryWrite(resultSpan, ref oid)) |
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 static string UsingSpanBase64(Guid oid, params string[] input) | |
{ | |
var totalUtf8Bytes = 36; // GUID.Format(D) = 36 bytes | |
for (int i = 0; i < input.Length; i++) | |
{ | |
totalUtf8Bytes += Encoding.UTF8.GetByteCount(input[i]); | |
} | |
Span<byte> resultSpan = stackalloc byte[Base64.GetMaxEncodedToUtf8Length(totalUtf8Bytes)]; | |
if (!Utf8Formatter.TryFormat(oid, resultSpan, out int writtenBytes) || writtenBytes != 36) |
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 static string UsingWebEncoders(string input) | |
{ | |
byte[] inputBytes = null; | |
char[] outputChars = null; | |
try | |
{ | |
var minimumLength = Encoding.UTF8.GetByteCount(input); | |
inputBytes = ArrayPool<byte>.Shared.Rent(minimumLength); | |
int inputBytesCount = Encoding.UTF8.GetBytes(input, 0, input.Length, inputBytes, 0); |
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
[GlobalSetup] | |
public void GlobalSetup() | |
{ | |
var rnd = new Random(); | |
_guid = Guid.NewGuid(); | |
var buffer = new byte[DataLen]; | |
rnd.NextBytes(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
public class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
CreateWebHostBuilder(args).Build().Run(); | |
} | |
public static IWebHostBuilder CreateWebHostBuilder(string[] args) => | |
WebHost | |
.CreateDefaultBuilder(args) |
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
[Route("api/[controller]")] | |
[ApiController] | |
public class ValuesController : ControllerBase | |
{ | |
private readonly ILogger<ValuesController> _logger; | |
public ValuesController(ILogger<ValuesController> logger) | |
{ | |
_logger = logger ?? throw new ArgumentNullException(nameof(logger)); | |
} |
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
{ | |
"Logging": { | |
"LogLevel": { | |
"Default": "Verbose" | |
}, | |
"ScopeLevel": { | |
"ScopeFilteringWebApplication": "PlainText", | |
"Default": "None" | |
} | |
}, |
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
{ | |
"Logging": { | |
"LogLevel": { | |
"Default": "Verbose" | |
} | |
}, | |
"AllowedHosts": "*" | |
} |
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
class Program | |
{ | |
static async Task Main(string[] args) | |
{ | |
Console.WriteLine("Starting, press a key to continue ..."); | |
Console.ReadKey(); | |
var ips = await Dns.GetHostAddressesAsync("www.google.com"); | |
foreach (var ipAddress in ips) |
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
Microsoft.WindowsAzure.ServiceRuntime Information: 200 : Role entrypoint . CALLING OnStart(): Microsoft.WindowsAzure.ServiceRuntime.ProgramEntryPoint | |
Microsoft.WindowsAzure.ServiceRuntime Information: 202 : Role entrypoint . COMPLETED OnStart(): Microsoft.WindowsAzure.ServiceRuntime.ProgramEntryPoint | |
The thread 0x7bbc has exited with code 0 (0x0). | |
Microsoft.WindowsAzure.ServiceRuntime Information: 203 : Role entrypoint . CALLING Run(): Microsoft.WindowsAzure.ServiceRuntime.ProgramEntryPoint | |
Microsoft.WindowsAzure.ServiceRuntime Verbose: 500 : Role instance status check starting | |
Microsoft.WindowsAzure.ServiceRuntime Verbose: 502 : Role instance status check succeeded: Ready | |
Microsoft.WindowsAzure.ServiceRuntime Verbose: 500 : Role instance status check starting | |
Microsoft.WindowsAzure.ServiceRuntime Verbose: 502 : Role instance status check succeeded: Ready | |
WaWorkerHost.exe Information: 0 : NetCoreConsoleApp:Initiliaze:0 | |
WaWorkerHost.exe Information: 0 : NetCoreConsoleApp:GetCscfgSetting('foo'):bar |
NewerOlder