Download presentation
Presentation is loading. Please wait.
Published byAlexander Shelton Modified over 9 years ago
1
C Sharp Web & Internet Programming Group Diana, Aren, Jeff, & Adam, Farrin 5/5/20081CS 311
2
Anders Hejlsberg formed a team January 1999 Publicly announced July 2000 Third Version in June 2005 5/5/20082CS 311
3
Visual J++ Turbo Pascal Based on Java Delphi Smalltalk Based on C++ Visual Basic 5/5/20083CS 311
4
Simple General-purpose OOP Ground up design Components High Level Source code Portable Compiled 5/5/20084CS 311
5
Preprocessor directives No Actual preprocessor Symbols but no macros 5/5/20085CS 311
6
Int Long Char Float Bool Double Byte Word 5/5/20086CS 311
7
Type safety Implicit conversions Enumeration members are placed in their own namespace. Type Reflection 5/5/20087CS 311
8
C# supports a strict Boolean type, Bool Conditionals No 1=True Easy conversion If(a=b) mistake 5/5/20088CS 311
9
New features Can be cross-language C++ templates can not Type Constraints No non-typed parameters 5/5/20089CS 311
10
global variables Methods and members shadow variables Similar to C++ and Java Int A=1; string B = Boo; 5/5/200810CS 311
11
Similar to C++ If( Bool){} While(Bool){} 5/5/200811CS 311 No Global functions All method and member functions must be declared within classes
12
C# pointers Managed memory Garbage collected 5/5/200812CS 311
13
Similar to C++ class example_class { { // implementation } } All methods and members Multiple Inheritance 5/5/200813CS 311
14
5/5/200814CS 311 Allows class implementation across more than one source file. file1.cs: public partial class MyClass { public MyClass() { // implementation } } file2.cs: public partial class MyClass { public void SomeMethod() { // implementation } }
15
Light weight classes Allocated on stack 5/5/200815CS 311
16
A dynamic linking library(s) Shared Libraries 5/5/200816CS 311
17
// File: Add.cs namespace UtilityMethods { public class AddClass { public static long Add(long i, long j) { return (i + j); } } } namespace UtilityMethods { public class MultiplyClass { public static long Multiply(long x, long y) { return (x * y); } } } 5/5/200817CS 311
18
// File: TestCode.cs using UtilityMethods; class TestCode { static void Main(string[] args) { System.Console.WriteLine ("Calling methods from MathLibrary.DLL:"); if (args.Length != 2) { System.Console.WriteLine("Usage: TestCode "); return; } long num1 = long.Parse(args[0]); } } 5/5/200818CS 311
19
New int foo = 42; // Value type... object bar = foo; // foo is boxed to bar. int foo = 42; // Value type. object bar = foo; // foo is boxed to bar. int foo2 = (int)bar; // Unboxed back to value type. 5/5/200819CS 311
20
August 2000 Specs submitted + CLI ISO Standard 2003 June 2005 third edition Approved 5/5/200820CS 311
21
using System; // A "Hello World!" program in C# namespace Hello World { class Hello { static void Main() { System.Console.WriteLine("Hello World!"); } } } 5/5/200821CS 311
22
// /* */ XML documentation 5/5/200822CS 311
23
.NET Only available on Windows Greater resources required Nonstandard classes 5/5/200823CS 311
24
www.en.wikipedia.com\c-sharp.html www.en.wikipedia.com\c-sharp.html http://msdn.microsoft.com/vcsharp/ http://msdn.microsoft.com/vcsharp/ http://msdn2.microsoft.com/en- us/library/67ef8sbd(VS.80).aspx http://msdn2.microsoft.com/en- us/library/67ef8sbd(VS.80).aspx http://msdn2.microsoft.com/en- us/vcsharp/aa336809.aspx http://msdn2.microsoft.com/en- us/vcsharp/aa336809.aspx http://standards.iso.org/ittf/PubliclyAvailabl eStandards/c042926_ISO_IEC_23270_2006(E).z ip http://standards.iso.org/ittf/PubliclyAvailabl eStandards/c042926_ISO_IEC_23270_2006(E).z ip 5/5/200824CS 311
25
New file1.cs: public partial class MyClass { public MyClass() { // implementation } } file2.cs: public partial class MyClass { public void SomeMethod() { // implementation } } 5/5/200825CS 311
26
No Global functions All method and member functions must be declared within classes 5/5/200826CS 311
27
// Method that takes an iterable input (possibly an array) and returns all even numbers. public static IEnumerable GetEven(IEnumerable numbers) { foreach (int i in numbers) { if (i % 2 == 0) yield return i; } } 5/5/200827CS 311
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.