Presentation is loading. Please wait.

Presentation is loading. Please wait.

C# EMILEE KING. HISTORY OF C# In the late 1990’s Microsoft recognized the need to be able to develop applications that can run on multiple operating system.

Similar presentations


Presentation on theme: "C# EMILEE KING. HISTORY OF C# In the late 1990’s Microsoft recognized the need to be able to develop applications that can run on multiple operating system."— Presentation transcript:

1 C# EMILEE KING

2 HISTORY OF C# In the late 1990’s Microsoft recognized the need to be able to develop applications that can run on multiple operating system platforms. This led to the creation of the.NET Framework. In the Pre-release stage the.NET Framework used multiple languages

3 HISTORY OF C# C++, Visual, and ASP all of which were used for different parts of the framework and were not interchangeable. Anders Hejlsberg and his team wanted to be able to offer a more unified solution for this framework. Modern concepts, such as object orientation, type safety, and garbage collection and structured exception handling directly into the platform.

4 HISTORY OF C# COOL: C-Like Object Oriented Language C++ was seen as an increment of C C++++ so C# can be seen as an increment of C++ The name for C# was changed and the language was publicly announced alongside the.NET project at the July 2000 Professional Developers Conference.

5 NAMES Case-Sensitive: : sumOfAverages, SumOfAverages, SUMOFAVERAGES PascalCasing for class names and method names camelCasing for method arguments and local variables Use noun or noun phrases to name a class Avoid using SCREAMINGCAPS for constants or readonly variables

6 KEYWORDS C# has two different types of keywords, contextual keywords and reserved keywords. Contextual keywords are only treated as keywords in certain situations. Reserved keywords are treated like keywords in all situations. Both are always lowercase

7 BINDINGS Static and Dynamic C# defaults to static Allows dynamic binding for certain operations: Member access Element access Method invocation Assignment operators

8 DATA TYPES: VALUE TYPES Instances of value types are allocated on the stack. Primitive Data Types: Int, Float, Char. User Defined Structures (Structs) Cannot derive from each other Cannot have explicit constructors Bound to their variables, so inefficient for sharing data between classes

9 DATA TYPES: REFERENCE TYPES Instances of a reference type are allocated in the heap. Strings, Arrays, Class types, Delegates Contains the address of a location in memory where the data referred to by that variable is stored When the variable is not referencing any object the variable will be null. Will not be destroyed until C#’s garbage collection system determines that it is no longer needed.

10 GENERICS C# is a strongly typed language Generics were introduced in Version 2.0 of.NET Framework Combine reusability, type safety and efficiency in a way that their non- generic counterparts cannot Avoids computational cost of boxing and unboxing. Allows the compiler to do type-checking

11 ARRAYS One dimension Multidimensional Array of Arrays (Jagged Arrays)

12 EXPRESSIONS AND ASSIGNMENT STATEMENTS Left to Right Primary: x.y, f(x), a[x], x++, x-- Unary: +, -, !, ~, ++x, --x, (T)x PEMDAS Shift: > Relational and type testing:, =, is, as Equality: ==, != Logical Expressions: &, ^, | Conditional Expressions &&, ||, ?:

13 CONDITIONAL STATEMENTS If-else Else-if Switch Statements

14 ITERATIVE STATEMENTS While Do While For Loop For Each Loop

15 METHODS Methods define how a class should behave Structs can have methods Can not be nested Can be passed as parameters called Delegates Can have any type including user defined and void

16 CLASSES Reference Types Can be nested Support inheritance Used for data that might be modified after the class is created Can implement interfaces

17 STRUCTS Value type Do not support inheritance Used for data that will not be modified after the struct is created Can implement interfaces Unlike C++ structs, C# structs are light weight classes

18 OPERATOR OVERLOADING Unary, binary, and comparison operators can be overloaded Cast operators and array indexing cannot be overloaded Conversion operators can be defined for cast operators New indexers can be defined for array indexing

19 ABSTRACT DATA TYPES AND ENCAPSULATION CONSTRUCTS Similar to C++ and Java C# allows destructors, although rarely used due to garbage collection Two new access modifiers: Internal and Protected Internal Properties can implement getters and setters without explicit method calls

20 SUPPORT FOR OBJECT ORIENTED PROGRAMMING Encapsulation Inheritance Polymorphism Dynamic Binding Nested classes Classes and Structs can implement interfaces

21 CONCURRENCY Based largely on Java Supports actor and server threads Built in classes for thread synchronization Interlocked class Monitor class

22 EXCEPTION HANDLING Large amount of predefined exception classes Allows user defined exceptions Try block is where potential problem code is located Catch catches an exception (also known as exception filter) Finally block executes code regardless of how try block is exited

23 EVENT HANDLING Static and Dynamic Static: only in effect in the class of the events that they handle Dynamic: activated and deactivated throughout the entire program in response to their conditional programming logic. Both use two parameters that are always of type object and EventArgs

24 READIBILITY Very organized Regions Intuitive User defined structs and enumerations allows programmers to clearly label what their program is doing

25 WRITABILITY Many different ways to write code and get the same effect Intuitive Allows for user defined structs and enumerations

26 RELIABILITY Strongly typed language Strict with type checking Large amount of built in exception handling Allows for user defined exception handling Unsafe code has to be explicitly marked and enabled in the compiler Large amount of documentation online

27 COST Visual Studio Commercial Version Training Large amount of documentation online by Microsoft Updates


Download ppt "C# EMILEE KING. HISTORY OF C# In the late 1990’s Microsoft recognized the need to be able to develop applications that can run on multiple operating system."

Similar presentations


Ads by Google