








































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!









































Hello World
import
System; import
System; import
System; import
System;
System.out.printlnSystem.out.printlnSystem.out.printlnSystem.out.println
Command Line Compiler
!^ Create source file:
Hello.cs.
!^ Invoke compiler:
csc
Hello.cs
!^ If OK,
Hello.exe
is created.
!^ Run executable:
Hello
C# Program Structure
!^ Namespaces
!^ Type declarations
!^ Members
namespace
N
{
// N
namespace
N
{
// N
namespace
N
{
// N
namespace
N
{
// N
class
C
{
// N1.C
class
C
{
// N1.C
class
C
{
// N1.C
class
C
{
// N1.C
class
C
{}
// N1.C1.C
class
C
{}
// N1.C1.C
class
C
{}
// N1.C1.C
class
C
{}
// N1.C1.C
}}}} namespace
N
{
// N1.N
namespace
N
{^
// N1.N
namespace
N
{
// N1.N
namespace
N
{^
// N1.N
class
C
{}
// N1.N2.C
class
C
{}
// N1.N2.C
class
C
{}
// N1.N2.C
class
C
{}
// N1.N2.C
}}}} } }}}
Namespace
= Packets Made Easy
using
System; using
System; using
System; using
System; namespacenamespacenamespacenamespace
MyMethodsMyMethodsMyMethodsMyMethods
public
class public
class public
class public
class
AddClassAddClassAddClassAddClass
public
static
long
public
static
long
public
static
long
public
static
long
AddAddAddAdd(long
i,^
long
j)^
(long
i,^
long
j)^
(long
i,^
long
j)^
(long
i,^
long
j)^
return(i+j);return(i+j);return(i+j);return(i+j);}}}} }}}} }}}} using^
System; using
System; using
System; using
System; namespacenamespacenamespacenamespace
MyMethodsMyMethodsMyMethodsMyMethods
public
class public
class public
class public
class
MultiplyClassMultiplyClassMultiplyClassMultiplyClass
public
static
long
public
static
long
public
static
long
public
static
long
MultiplyMultiplyMultiplyMultiply(long
i,^
long
j)^
(long
i,^
long
j)^
(long
i,^
long
j)^
(long
i,^
long
j)^
return(ij);return(ij);return(ij);return(ij);}}}} }}}} }}}}
Creating DLLs
Value Types
!^ primitives
!^ enums
!^ structs
Enums
Typesafe Enums in Java
Exceptions Does not show up
Constructors
(^ )(^ )(^ )(^ )
class
class
class
class
void
void
void
void
Console.WriteLineConsole.WriteLineConsole.WriteLineConsole.WriteLine
("("("("IA.gIA.gIA.gIA.g");
void
void
void
void
Console.WriteLineConsole.WriteLineConsole.WriteLineConsole.WriteLine
("("("("IC.fIC.fIC.fIC.f");
void
void
void
void
Console.WriteLineConsole.WriteLineConsole.WriteLineConsole.WriteLine
("("("("IB.fIB.fIB.fIB.f");
IA.gIA.gIA.gIA.gIC.fIC.fIC.fIC.fIB.fIB.fIB.fIB.f
interface
interface
interface
interface
void
g^ (); void
g^ (); void
g^ (); void
g^ (); }}}}
interface
interface
interface
interface
void
f^ (); void
f^ (); void
f^ (); void
f^ (); }}}}
interface
interface
interface
interface
void
f^ (); void
f^ (); void
f^ (); void
f^ (); }}}}
Interfaces
as/is
as/is