Skip to content

Instantly share code, notes, and snippets.

@mkrueger
Created June 18, 2012 13:03
Show Gist options
  • Save mkrueger/2948269 to your computer and use it in GitHub Desktop.
Save mkrueger/2948269 to your computer and use it in GitHub Desktop.
void Example3 ()
{
// More stingy case. Equivalent to Example2() only if MainClass is of reference type.
// Also, how to decide whether the assignments after the Add() calls belong to the previous
// or the next call to Add()? Needs data flow/dependency analysis?
MainClass tmp;
var items = new List<MainClass> ();
tmp = new MainClass ();
tmp.Data = "data";
tmp.Data2 = "data2";
items.Add (tmp);
tmp = new MainClass ();
tmp.Data = "data";
tmp.Data2 = "data2";
items.Add (tmp);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment