Created
April 14, 2014 16:13
-
-
Save anoxic/10661992 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| C# | |
| Variables declared with types: char letter = 'c'; | |
| short int long byte ushort uint ulong float double decimal | |
| char string | |
| bool | |
| Arrays declared with a []: int[] scores = new int[10] { 100, 95, 92, 87, 55, 50, 48, 40, 35, 10 }; | |
| Enumeration: public enum DaysOfWeek { Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday }; | |
| int today = DaysOfWeek.Tuesday; | |
| Casting - type in (): (float)total; | |
| Methods: static int Multiply(int a, int b) | |
| { | |
| return a * b; | |
| } | |
| Methods can have the same name and different signatures - | |
| Multiply(int, int), Multiply(double, double) | |
| Writing to console: Console.WriteLine(); | |
| Control statements are stand if, else if, else. | |
| Math, equality, unary operators are C-style. | |
| Loops: while(){}, do{}while(), for(;;){} | |
| using System; | |
| namespace Variables | |
| { | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| Console.WriteLine("Hello, world!"); | |
| } | |
| } | |
| } | |
| Program program = new Program(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment