|
|
Def start (): Pass |
Public void start () { } |
Def start (async as bool ): Pass |
Public void start (boolasync) { } |
Def start (async as bool) 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 t: Print "error happened" |
Try { // Do something } Catch { Console. writeline ("error Happened "); } |
Try: # Do something Except t e as soapexception: Print E. Detail Except t e: Print E |
Try { // Do something } Catch (soapexception E) { Console. writeline (E ); } Catch (exception E) { Console. writeline (E ); } |
Try: # Do something Except t e: Print E Ensure: Print "done" |
Try { // Do something } Catch (exception E) { Console. writeline (E ); } Finally { Console. writeline ("done "); } |
Try: # Do something Except t 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 */ |