13.07.2015 Views

C# Language Specification - Willy .Net

C# Language Specification - Willy .Net

C# Language Specification - Willy .Net

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>C#</strong> LANGUAGE SPECIFICATIONnamespace Acme{class Widget: IProcess{public static Widget operator+(Widget x) { /* … */ }}}"M:Acme.Widget.op_UnaryPlus(Acme.Widget)"The complete set of unary operator function names used is as follows: op_UnaryPlus,op_UnaryNegation, op_LogicalNot, op_OnesComplement, op_Increment, op_Decrement,op_True, and op_False.• Binary operators.namespace Acme{class Widget: IProcess{public static Widget operator+(Widget x1, Widget x2) { return x1; }}}"M:Acme.Widget.op_Addition(Acme.Widget,Acme.Widget)"The complete set of binary operator function names used is as follows: op_Addition,op_Subtraction, op_Multiply, op_Division, op_Modulus, op_BitwiseAnd, op_BitwiseOr,op_ExclusiveOr, op_LeftShift, op_RightShift, op_Equality, op_Inequality,op_LessThan, op_LessThanOrEqual, op_GreaterThan, and op_GreaterThanOrEqual.• Conversion operators have a trailing '~' followed by the return type.namespace Acme{class Widget: IProcess{public static explicit operator int(Widget x) { /* … */ }public static implicit operator long(Widget x) { /* … */ }}}"M:Acme.Widget.op_Explicit(Acme.Widget)~System.Int32""M:Acme.Widget.op_Implicit(Acme.Widget)~System.Int64"E.4 An exampleE.4.1 <strong>C#</strong> source codeThe following example shows the source code of a Point class:namespace Graphics{/// Class Point models a point in a two-dimensional plane./// public class Point{/// Instance variable x represents the point's/// x-coordinate.private int x;/// Instance variable y represents the point's/// y-coordinate.private int y;444

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!