CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Format:
Recent snippets for: InfinitiesLoop
C#
 
Foo foo1 = new Foo(),
    foo2 = new Foo(),
    foo3 = new Foo(),
    foo4 = new Foo();
 
foo1.Foos = new List<Foo> { foo2 };
foo2.Foos = new List<Foo> { foo2, foo3, foo4 };
 
var list = new List<Foo> { foo1, foo2 };
by InfinitiesLoop   August 27, 2010 @ 6:28pm
Tags: linq
167 Views
no comments
 
C#
 
// la la la
if (foo is ISomeInterface) {
    ((ISomeInterface)foo).SomeMethod();
}
else if (foo is ISomeOtherInterface) {
    ((ISomeOtherInterface)foo).SomeMethod();
}
else {
    throw new SomeException();
by InfinitiesLoop   August 09, 2010 @ 4:26pm
336 Views
2 comments
 
// If you have a lot of objects with structure to create, 
// the code can really add up.
// var a = { a: 1, b: 2, c: 3 },
//     b = { a: 4, b: 5, c: 6 }, etc..
// Especially if the field names (e.g. a, b, c)
// are long. Even when minified, these field names remain.
 
// Sacrificing a bit of performance, the script can be
// much more concise if we use a generic creation helper.
by InfinitiesLoop   May 07, 2010 @ 2:58pm
249 Views
no comments
 
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate