Preview only show first 10 pages with watermark. For full document please download

Csharp Basics Reference Sheet

Referência basica para comandos do C#

   EMBED


Share

Transcript

010010100101011010101101001010101001011101011010 Namespace using Namespace; Data Types byte,sbyte,int,uint,short,ushort,long,ulong,float,double,decimal,bool,char,string, object Variable Declaration public | protected internal | protected | internal | private As If Else if(expression) { ; } else { ; } C# version of IIF() variable == ?true:false; Type Declaration public | internal | private For Loop for(statement) { ; } Suffixes f -float, l,L - long, No double suffix, U,u - unsigned Arrays [] = new [ArraySize]; Initialize Array [] = new [ArraySize] {, , ... , }; Change Size of Array [] = new [ArraySize]; Array.Resize(ref , ); Comments //Comment text Multi-line comments /* This is commented */ For Each Loop foreach( In ) { ; [break]; [continue]; } While Loop while() { } XML Comments Press the / (forward slash) key 3 times. Do-While Loop do { ; } while ; Line Continuation string strtext = @“To break a long string across multiple lines, end the string, add the line continuation character and continue the string on the next line.”; Arithmetic Operators + (Addition), - (Subtraction), * (Multiplication), / (Division), % (Modulus) String Concatenation + Relational Operators < (Less Than), <= (Less Than or Equal To), > (Greater Than), >= (Greater Than or Equal To), == (Equal To),! = (Not Equal To), is, as Logical Operators & (And), | (Or), ^ (Xor),&& (AndAlso), || (OrElse) Assignment Operators = (Equals), += (Addition), -= (Subtraction), *= (Multiplication), /= (Division), %= (Modulus), &= (And),|= (OR), ^= (Exclusive OR), <<= (Left Shift), >>= (Right Shift), ?? String Manipulation .Substring(,[]) .Trim() .TrimEnd([]) .TrimStart([char array]) .ToLower() .ToUpper() .Replace(,) .Equals() <6 available overloads> .Contains() .Join(,,[]) .Compare(,,[]) <7 overloads available> .Copy() Error Handling try { //; } catch(Exception ex) { //; } finally { // } Select Case Statement switch() { case : ; ; case : ; ; ' ' default: ; ; } Function Structure [static] ([Parameters]) { //body of the function; return ; } Sub Procedure Structure void ([Parameters]) { //body of the procedure; } Class Structure public class { //body of class } public 'method_prototypes 'data_attributes private 'method_prototypes 'data_attributes internal 'method_prototypes static 'method_prototypes 'data_attributes Download More Reference Sheets & Get Programming Help @ http://www.DreamInCode.net Edited By:PsychoCoder, Martyr2 Published: October 9, 2007