Skip to content

Instantly share code, notes, and snippets.

View SteveSandersonMS's full-sized avatar

Steve Sanderson SteveSandersonMS

View GitHub Profile
@SteveSandersonMS
SteveSandersonMS / Home.cshtml
Created February 20, 2018 10:54
Manually implemented HTTP client
@using StandaloneApp.Util
@(Layout<StandaloneApp.Shared.MainLayout>())
<h1>Hello, world!</h1>
Welcome to your new app.
<button @onclick(DoRequest)>Do request</button>
<div><strong>Response: </strong>@responseText</div>
@functions {
@SteveSandersonMS
SteveSandersonMS / somefile.cs
Last active May 9, 2016 10:13 — forked from SteveSanderson/somefile.cs
Async void message loop
public class MyNetworkClient {
public event SomeDelegate OnException;
public async Task ConnectAsync(string address) {
await this.MakeTheActualConnection(address);
this.BeginReceiveLoop();
}
// It's async void! But is that bad?
// I know that an unhandled exception here is going to bring down the process, but where else do you want