|
|
def Start(): pass |
public void Start() { } |
def Start(async as bool): pass |
public void Start(boolasync) { } |
def Start(async as bool) as WaitHandle: raise NotImplementedException() |
public WaitHandle Start(boolasync) { throw new NotImplementedException(); } |
defGetInteger(): return 1 |
public intGetInteger() { return 1; } |
defSetItem(key,val): pass |
public void SetItem(object key, object val) { } |
defVarArgs(*args as (object)): pass
VarArgs(1, "foo") |
public void VarArgs(params object[] args) { } |
Name: get: return "Boo" |
public string Name { get { return "C#"; } } |
Email: get: return email set: email = value
Email: get: return email set: email = value |
public string Email { get { return email; } set { email = value; } } |
[property(Email)] email as string |
public string Email { get; set; } |
xml = XmlDocument() |
XmlDocument xml = new XmlDocument() |
emp = Employee(Name: "foo", Id: 15) |
varemp = new Employee{ Name = "foo", Id = 15}; |
class Car(): def constructor(): print "Car created!" |
public class Car { public Car() { Console.WriteLine("Car created!"); } } |
class Car(): def destructor(): print "died" |
public class Car { public ~Car() { Console.WriteLine("died"); } } |
raise NotImplementedException() |
throw new NotImplementedException(); |
raise "error happened" |
throw new Exception("error happened"); |
try: # do something except: print "error happened" |
try { // do something } catch { Console.WriteLine("error happened"); } |
try: # do something except e as SoapException: print e.Detail except e: print e |
try { // do something } catch(SoapException e) { Console.WriteLine(e); } catch(Exception e) { Console.WriteLine(e); } |
try: # do something except e: print e ensure: print "done" |
try { // do something } catch(Exception e) { Console.WriteLine(e); } finally { Console.WriteLine("done"); } |
try: # do something except e: print e raise |
try { // do something } catch(Exception e) { Console.WriteLine(e); throw; } |
save.Click += do(sender,e): print "Clicked" |
save.Click += delegate( object sender, EventArgs e ) { Console.WriteLine("Clicked"); } |
save.Click += { print "Clicked" } |
save.Click += (sender, e) => Console.WriteLine("Clicked"); |
myList.Find( { i | i > 5 }) |
myList.Find(delegate(int i) { return i> 5; }); |
namespace Foo.Bar.Baz class Foobar: pass |
namespace Foo.Bar.Baz { public class Foobar { } } |
self.name = "foo"; |
this.name = "foo"; |
super.name = "foo"; |
base.name = "foo"; |
# single line comment // and this is one as well /* And here is a multi line comment */ |
// single line comment /* Multi line comment */ |