C# Cheat Sheet 2020



C $72.13 -$0.32 -0.4% Price as of April 19, 2021, 4:00 p.m. ET View Interactive C Charts. Tidy Evaluation with rlang Cheatsheet. Tidy Evaluation (Tidy Eval) is a framework for doing non-standard evaluation in R that makes it easier to program with tidyverse functions. Non-standard evaluation, better thought of as “delayed evaluation,” lets you capture a user’s R code to run later in a new environment or against a new data frame.

Data Types

bool

C-like languages feature two versions (pre- and post-) of each operator with slightly different semantics. In languages syntactically derived from B (including C and its various derivatives), the increment operator is written as and the decrement operator is written as -. Several other languages use inc(x) and dec(x) functions.

Boolean valuebyte8-bit unsigned integerchar16-bit Unicode characterdecimal128-bit precise decimal values with 28-29 signif­icant digitsdouble64-bit double­-pr­ecision floating pointfloat32-bit single­-pr­ecision floating pointint32-bit signed integerlong64-bit signed integerobjectBase type for all other typessbyte8-bit signed integershort16-bit signed integerstringString valueuint32-bit unsigned integerulong64-bit unsigned integerushort16-bit unsigned integer

Type Conversion Methods

ToBooleanToByteToCharToDateTimeToDecimalToDoubleToInt16ToInt32ToInt64ToSbyteToSingleToStringToTypeToUInt16ToUInt32ToUInt64

Naming Conven­tions

ClassMyClassMethodMyMethodLocal variablemyLoca­lVa­riablePrivate variable_myPri­vat­eVa­riableConstantMyConstant

Arrays

int[] array = new int[] {1, 2, 3}int[] array = {1, 2, 3}var array = new int[] {1, 2, 3}int[] array = new int[3]

Statements

if-elseif (true) {..}
else if (true) {..}
else {..}switchswitch (var) {
case 1: break;
default: break; }forfor (int i =1; i < 5; i++) {..}foreach-inforeach (int item in array) {..}whilewhile (true) {..}do.. whiledo {..}
while (true);try-ca­tch­-fi­nallytry {..}
catch (Exception e) {..}
catch {..}
finally {..}

Classes

Classpublic class Dog {..}Inheri­tancepublic class Dog: Pet {..}Constr­uctor (no parame­ters)public Dog () {..}Constr­uctors can co-existConstr­uctor (one parameter)public Dog (string var) {..}Constr­uctors can co-existFieldpublic string nameStatic Classpublic static class Dog {..}Must only have static membersStatic Memberpublic static int = 1Finalizer (destr­uctor)~Dog () {..}Cannot have modifiers or parameters

Access Modifiers

publicAccessible by any other code in the same assembly or another assembly that references itprivateOnly accessible by code in the same class or structprotectedOnly accessible by code in the same class or struct, or in a derived classinternalAccessible by any code in the same assembly, but not from another assemblyprotected internalAccessible by any code in the same assembly, or by any derived class in another assembly

Other Modifiers

abstractIndicates that a class is intended only to be a base class of other classesasyncIndicates that the modified method, lambda expres­sion, or anonymous method is asynch­ronousconstSpecifies that the value of the field or the local variable cannot be modifiedeventDeclares an eventexternIndicates that the method is implem­ented externallynewExplicitly hides a member inherited from a base classoverrideProvides a new implem­ent­ation of a virtual member inherited from a base class

C# Syntax Cheat Sheet

partialDefines partial classes, structs and methods throughout the same assemblyreadonlyDeclares a field that can only be assigned values as part of the declar­ation or in a constr­uctor in the same classsealedSpecifies that a class cannot be inheritedstaticDeclares a member that belongs to the type itself instead of to a specific objectunsafeDeclares an unsafe contextvirtualDeclares a method or an accessor whose implem­ent­ation can be changed by an overriding member in a derived classvolatileIndicates that a field can be modified in the program by something such as the operating system, the hardware, or a concur­rently executing thread

Assignment Operators

=Simple assignment+=Addition assignment-=Subtra­ction assignment*=Multip­lic­ation assignment/=Division assignment%=Remainder assignment&=

C# Reference Sheet

CheatAND assignment|=OR assignment^XOR assignment<<=Left-shift assignment>>=Right-­shift assignment

Comparison Operators

<Less than>Greater than<=Less than or equal to>=Greater than or equal toEqual to!=Not equal to

Arithmetic Operators

+Add numbers-Subtract numbers*Multiply numbers/Divide numbers%Compute remainder of division of numbers++Increases integer value by 1--Decreases integer value by 1

Logical and Bitwise Operators

&&Logical AND||Logical OR!Logical NOT&Binary AND|Binary OR^Binary XOR~Binary Ones Complement<<Binary Left Shift>>Binary Right Shift

Other Operators

sizeof()Returns the size of a data typetypeof()Returns the type of a class&Returns the address of a variable*Pointer to a variable? :Condit­ional expressionisDetermines whether an object is of a specific typeasCast without raising an exception if the cast fails

Locomotives operated by the Chesapeake and Ohio Railway.

Steam locomotives[edit]

Class A: 4-4-0 and 4-4-2[edit]

Class B: 2-10-2[edit]

Class C: 0-6-0, 0-8-0, 0-10-0, and Shays[edit]

Class E: 2-6-0[edit]

Class F: 4-6-0 and 4-6-2[edit]

Class G: 2-8-0[edit]

Class H: 2-6-6-2, 2-8-8-2, 2-6-6-6[edit]

Nero burning rom 2019 full version. Class H was used for the 2-6-6-2, 2-8-8-2, and 2-6-6-6 Allegheny types

  • Chesapeake and Ohio class H-1 2-6-6-2
  • Chesapeake and Ohio class H-2 2-6-6-2
  • Chesapeake and Ohio class H-3 ex-Hocking Valley Railway 2-6-6-2
  • Chesapeake and Ohio class H-4 2-6-6-2
  • Chesapeake and Ohio class H-5 2-6-6-2
  • Chesapeake and Ohio class H-6 2-6-6-2
  • Chesapeake and Ohio class H-7 and H-7-A 2-8-8-2
  • Chesapeake and Ohio class H-8 2-6-6-6

Class J: 4-8-2 and 4-8-4[edit]

Class J was used for 4-8-2 Mountain and 4-8-4 Greenbrier types

  • Chesapeake and Ohio class J-1 4-8-2
  • Chesapeake and Ohio class J-2 4-8-2
  • Chesapeake and Ohio class J-3 and J-3-A 4-8-4

Class K: 2-8-2 and 2-8-4[edit]

C&O's 'Big Mike' #2705, a 2-8-4 Class K-4 'Kanawha' built by Alco in 1943, at the B&O Railroad Museum in 2008
2020

Class K was used for 2-8-2 Mikado and 2-8-4 Kanawha types

  • Chesapeake and Ohio class K ex-Hocking Valley Railway 2-8-2
  • Chesapeake and Ohio class K-1 2-8-2
  • Chesapeake and Ohio class K-2 2-8-2
  • Chesapeake and Ohio classes K-3 and K-3-A 2-8-2
  • Chesapeake and Ohio class K-4 2-8-4
  • Chesapeake and Ohio class K-5 ex-Pere Marquette Railway 2-8-2
  • Chesapeake and Ohio class K-6 ex-Pere Marquette Railway 2-8-2
  • Chesapeake and Ohio class K-8 ex-Pere Marquette Railway 2-8-2

Class L: 4-6-4[edit]

C&O L-1 class

Class L was used for 4-6-4 'Hudson' types.

Class M: Steam-Turbine-Electric[edit]

Class M was used for a single class of 2-C1+2-C1-2 Steam-turbine electric locomotives.

Class N: 2-8-4[edit]

  • Chesapeake and Ohio class N ex-Pere Marquette Railway 2-8-4
  • Chesapeake and Ohio class N-1 ex-Pere Marquette Railway 2-8-4
  • Chesapeake and Ohio class N-2 ex-Pere Marquette Railway 2-8-4

Class T: 2-10-4[edit]

Class T was used for a single class of 2-10-4 'Texas' types

Excel

Diesel locomotives[edit]

ALCO[edit]

  • S-2 58 engines built 1949–1950
  • S-4 14 engines built 1953
  • RS-2 2 engines built 1949, and later sold to Lehigh Valley Railroad
  • RSD-5 26 engines built 1952
  • RS-1 2 engines built 1953
  • RS-3 2 engines built 1955
  • RSD-12 10 engines built 1956
  • RSD-7 12 engines built 1956, retired and traded to GE 1969
  • C-630 4 engines built 1967, and later sold to Robe River Mining of Australia

Baldwin[edit]

  • DRS-6-6-1500 3 engines built 1949
  • AS-616 39 engines built 1950–1953

EMD[edit]

Switchers

  • NW2 35 built for the C&O
  • SW7 26 built for the C&O
  • SW9 35 built for the C&O
  • TR3 Cow-Calf-Calf 2 sets built in 1949
  • TR4 Cow-Calf 2 sets built and operated together for use on the Dawkins Sub. out of Paintsville, KY.

Passenger Cab units

  • E8A 31 built for the C&O

Freight Cab units

  • F7A 94 built for the C&O
  • F7B 54 built for the C&O
  • FP7 16 built for the C&O

Road Switchers

C# Programming Cheat Sheet

General Purpose (GP) 4 Axle

  • GP7 180 built for the C&O
  • GP9 363 Built for the C&O
  • GP30 48 Built for the C&O
  • GP35 41 Built for the C&O
  • GP38 60 Built for the C&O
  • GP39 20 Built for the C&O
  • GP40 50 Built for the C&O

Special Duty (SD) 6 Axle Affinity photo 2020.

  • SD18 19 Built for the C&O
  • SD35 14 Built for the C&O
  • SD40 59 Built for the C&O
  • SD50 43 Built for the C&O

C# Cheat Sheet 2020 Printable

GE[edit]

Road Switcher 4 Axle

  • U23B 30 Built for the C&O
  • U25B 38 Built for the C&O
  • U30B 33 Built for the C&O

Road Switcher 6 Axle

  • U30C 13 Built for the C&O

Dash 7

  • B30-7 30 Built for the C&O

References[edit]

  • Drury, George H (1993). Guide to North American Steam Locomotives. Kalmbach Publishing Company. pp. 78–88. ISBN0-89024-206-2.
  • Doyle, Jerry (2006). Chesapeake & Ohio Diesel Locomotives in Color 1949 - 1971. Chesapeake & Ohio Historical Society. pp. 37, 52, 88–89, 100, 122. ISBN1-883089-97-2.
Retrieved from 'https://en.wikipedia.org/w/index.php?title=List_of_Chesapeake_and_Ohio_locomotives&oldid=1008888039'