Skip to content

Instantly share code, notes, and snippets.

private void TriggerChildObjects(object sender, EventArgs e)
{
countLabel.Text = "InvocationList contains " +
(ev_Click == null?0:ev_Click.GetInvocationList().Length) + " objects";
}
private void Dispose(object sender, EventArgs e)
{
if (ev_Click == null)
return;
foreach (var w in ev_Click.GetInvocationList())
{
using (var x = w.Target as IDisposable)
{
x.Dispose();
}
@mclasson
mclasson / gist:2b3a49f98d8c3a56e118
Last active August 29, 2015 14:05
Linq deferred execution
//Prepare test data. Could be a set returned
//from a database query
var list = new List<int>();
for (int i = 0; i < 1000000; i++)
{
list.Add(i);
}
//Filter out a small subset of the data [zip code, annual income]
var listSmall = list.Where(i => i > 100000 && i < 150000);
//Prepare test data. Could be a set returned
//from a database query
var list = new List<int>();
for (int i = 0; i < 1000000; i++)
{
list.Add(i);
}
//Prepare a list to hold the results
//E.g list of all users born a certain year
var listOfInts = new List<IEnumerable<int>>();
library("httr")
httr::set_config(config(http_version = 2)) # set the HTTP version to 1.1 (none, 1.0, 1.1, 2)
sendMail <- function(e){
body <- list(secret = 'sfsdf£$4500dfdd__$$', body=e["message"]) # create a list that will be serialized to JSON
result <- POST(url = "https://prod-10.westeurope.logic.azure.com/workflows/8934jadajada999"
, body = body , encode = "json", handle = NULL)