Page MenuHomePhabricator
Authored By
stwalkerster
Jun 15 2016, 2:55 AM
Size
648 B
Referenced Files
None
Subscribers
None
// Let's have a class. It's sealed for some reason so we can't extend it.
public sealed class Foo
{
// This class has two properties, but has nothing useful here.
public int Value1 {get;set;}
public int Value2 {get;set;}
}
// let's say I want to add the two numbers together. Because this is a Complicated Operation (tm), I'm gonna write an extension method to do it.
public static class HandyStuff
{
public static int SumThings(this Foo x)
{
return x.Value1 + x.Value2;
}
}
// let's get an instance...
var foo = new Foo { Value1 = 3, Value2 = 4 };
// Now, I can do stuff like this:
var result = foo.SumThings();

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
736
Default Alt Text
(648 B)

Event Timeline