Introduction To C#: Tom Roeder CS 215 2006fa
Introduction To C#: Tom Roeder CS 215 2006fa
Introduce C# language
ECMA standard originally developed by MSR not just Java + C++ many extensions future of Windows base of Microsofts C# implementation
Non-goals
should be very comfortable writing OO code we will not cover much if any basic programming not even teach you OO style (except wrt C#) expected to write all code in OO style S/U only even homework
S/U Details
come to lecture participate do three assignments will not be giving a detailed grade show me that you understand the concepts, and can write C# code
Administrative Details
tmroeder@cs.cornell.edu (4112 Upson) really: experience in OO coding/concepts Do not submit work that is not your own minimum penalty: U in the course
Prerequisites: CS 211/212
Academic Integrity
Useful Tools
Visual C#
Mono: http://www.go-mono.com
Open Source impl for Linux: not quite at 2.0 Shared Source impl for Windows (through 2.0) Used to work on BSD / OS X, too
Rotor: http://msdn.microsoft.com/net/sscli
Useful Tools
Portable.NET: http://www.dotgnu.org
yet another open source impl we will use this for homework turn on your email notifications!
CMS: http://cms.csuglab.cornell.edu
will post lectures online as well as any errata for the homework
CSUGLab
MSDNAA access: let me know if you dont currently have it http://www.csuglab.cornell.edu/userinfo.html Visual Studio .NET 2005 should be installed there
Syllabus
C# constructs: 5 lectures Types, Delegates, Generics, Reflection, Iterators .NET Memory Management: 1 lecture Topics: 4 lectures C# 3.0, Threading, Security, MSIL, MSH
Quiz 1
not for credit but for knowledge but I will collect them and see what you know OO programming, mainly to do with Java If you dont know Java, but do have OO experience, its OK talk to me after if you have trouble
What is .NET?
runs all programs C# compiles to Microsoft Intermediate Language MSIL runs on CLR Virtual Machine like Java code written in many languages compiles to MSIL
What is .NET?
Web Services
Sharepoint ... ...
Enterprise Servers
SQL Server BizTalk ...
Runtime
Common Type System Common Language Runtime
.NET Framework
Operating System
From MSDN
any language that runs in CLR should implement no syntax specified Languages often define aliases CTS defines System.Int32 4 byte integer C# defines int as an alias of System.Int32
For example
From MSDN
how methods may be called when constructors are called subset of the types in CTS are allowed
For example
Code that takes UInt32 in a public method UInt32 is not in the CLS not marked is assumed to mean not compliant
Assemblies
shared: well-known location, can be GAC strong names: use crypto for signatures
COM vs .NET
support for interfaces and interaction given a GUID, lookup the type library dynamically instantiate class do RPC to make calls in many cases software engineering problems not type safe at all
thus can write typesafe code server-side or client-side Sharepoint interactions can log in in the manner of ODBC provides classes for access
Windows PowerShell
instantiates arbitary .NET classes and accesses them Also can access COM objects
Allows better interaction with programs Can it surpass bash and others?
First C# Program
using System; namespace Test { int a = 137; class Hello { public static void Main(string[] args) { Console.WriteLine(Hello {0}, a); } } }
Constructions of Note
using
like import in Java: bring in namespaces disambiguation of names like Internet hierarchical names and Java naming like in Java single inheritance up to object
namespace
class
Constructions of Note
Console.Write(Line)
Test + a