SlideShare una empresa de Scribd logo
1 de 44
Intro	
  to	
  .NET	
  and	
  Core	
  C#	
  

           Jussi	
  Pohjolainen	
  
.NET	
  Framework	
  
•  So=ware	
  framework	
  developed	
  by	
  MS	
  
   –  Runs	
  primarily	
  on	
  windows	
  
•  Benefits	
  
   –  Support	
  for	
  numerous	
  programming	
  languages	
  
   –  Language	
  integra2on	
  
        •  You	
  can	
  mix	
  different	
  languages	
  
   –  Comprehensive	
  base	
  class	
  library	
  
   –  Apps	
  runs	
  on	
  top	
  of	
  virtual	
  machine	
  
        •  Support	
  for	
  other	
  operaIng	
  systems	
  (in	
  theory)	
  
   –  Great	
  tools:	
  Visual	
  Studio	
  
Common	
  Language	
  Infrastructure	
  (CLI)	
  
CLI	
  
•  CLI	
  is	
  an	
  open	
  specificaIon	
  that	
  describes	
  
   executable	
  code	
  and	
  runIme	
  environment	
  
•  CLI	
  is	
  core	
  of	
  
    –  Microso=	
  .NET	
  Framework	
  
    –  Mono	
  (Open	
  Source)	
  
    –  Portable.net	
  (Open	
  Source)	
  	
  
CTS,	
  CLS,	
  CIL	
  
•  Common	
  Type	
  System	
  (CTS)	
  
   –  A	
  set	
  of	
  data	
  types	
  and	
  operaIons	
  that	
  are	
  share	
  by	
  
      all	
  CTS-­‐compliant	
  programming	
  languages,	
  such	
  as	
  C#	
  
      and	
  VB	
  
•  Common	
  Language	
  SpecificaIon	
  (CLS)	
  
   –  Set	
  of	
  base	
  rules	
  to	
  which	
  any	
  language	
  targeIng	
  the	
  
      CLI	
  should	
  conform.	
  	
  
•  Common	
  Intermediate	
  Language	
  (CIL)	
  
   –  Intermediate	
  language	
  that	
  is	
  abstracted	
  from	
  the	
  
      plaTorm	
  hardware	
  (In	
  Java:	
  class)	
  
Mono:OSX	
  »	
  C#	
  File	
  
Mono:OSX	
  »	
  Building	
  
Mono:OSX	
  »	
  Running	
  
Developer	
  Command	
  Prompt	
  for	
  VS2012	
  
Common	
  Language	
  RunIme:	
  Mac	
  

                                  Dropbox	
  –	
  
                                    folder	
  
Common	
  Language	
  RunIme:	
  Win	
  




                                 And	
  run	
  
                                the	
  .exe	
  in	
  
                                Windows!	
  
Compiling	
  Several	
  Files	
  in	
  C#	
  
C:CodeSample> csc /main:A /out:example.exe A.cs B.cs

C:CodeSample> example.exe
 Hello World from class A

C:CodeSample> csc /main:B /out:example.exe A.cs B.cs

C:CodeSample> example.exe
 Hello World from class B
Open	
  Source	
  DistribuIons	
  
•  h_p://www.mono-­‐project.com	
  
•  h_p://www.gnu.org/so=ware/dotgnu/
   pnet.html	
  
IDEs	
  
•  You	
  can	
  compile	
  and	
  run	
  apps	
  in	
  commandline	
  
    –  Several	
  good	
  text	
  editors:	
  notepad++,	
  sublime	
  
       text,	
  emacs	
  
•  SharpDevelop	
  
    –  Open	
  source	
  IDE	
  for	
  .NET	
  
•  MS	
  Visual	
  Studio	
  Express	
  
    –  Object	
  browsing	
  tools,	
  GUI	
  ediIng,	
  Intellisense	
  
Visual	
  Studio	
  
C#	
  
•  C#	
  is	
  very	
  similar	
  to	
  Java	
  
    –  C#,	
  Java,	
  ObjecIve-­‐C	
  and	
  C++	
  are	
  a	
  member	
  of	
  C	
  
       family	
  of	
  programming	
  languages	
  
•  C#	
  provides	
  more	
  syntax	
  than	
  Java,	
  although	
  
   Java	
  7	
  (and	
  upcoming	
  8)	
  is	
  “catching	
  up”	
  
•  In	
  this	
  course,	
  we	
  focus	
  on	
  C#	
  (instead	
  of	
  
   other	
  CIL	
  complient	
  languages)	
  
About	
  Namespaces	
  
•  Libraries	
  give	
  you	
  exisIng	
  code	
  to	
  use	
  
•  In	
  .NET:	
  namespaces	
  
    –  Using	
  System.CollecIons;	
  
    –  Using	
  System.IO;	
  
    –  Using	
  System.XML;	
  
•  System	
  is	
  not	
  the	
  root,	
  you	
  may	
  find	
  namespaces	
  
   like	
  Microso=	
  that	
  provides	
  services	
  unique	
  to	
  
   Windows	
  (can’t	
  run	
  on	
  other	
  systems)	
  
•  Namespaces	
  are	
  linked	
  to	
  files,	
  assemblies.	
  One	
  
   assembly	
  (mscorlib.dll)	
  can	
  contain	
  number	
  of	
  
   namespaces.	
  
Assemblies:	
  c:/windows/assembly	
  
Adding	
  a	
  Assembly	
  in	
  VS	
  
•  When	
  wriIng	
  
    –  Using	
  System.Windows.Forms;	
  
•  This	
  uses	
  a	
  assembly	
  
   System.Windows.Forms.dll	
  
•  You	
  must	
  add	
  this	
  as	
  a	
  reference	
  in	
  your	
  
   project!	
  
•  How?	
  
    –  In	
  VS:	
  SoluIon	
  Explorer	
  >	
  References	
  >	
  Add	
  
       Reference	
  
C#	
  
using System;

class MyApp
{
     public static void Main()
     {
          Calculator c = new Calculator();
          Console.Write(c.calculate(5,5));
     }
}

class Calculator {
     public int calculate(int a, int b)
     {
          return a + b;
     }
}
Ildasm.exe:	
  examine	
  the	
  CIL	
  
About	
  Windows	
  8	
  
•  Visual	
  Studio	
  2012	
  provides	
  templates	
  for	
  Win	
  
   8	
  app	
  development	
  
•  EnIrely	
  new	
  runIme:	
  Windows	
  Run2me	
  
   (WinRT)	
  
•  New	
  namespaces,	
  starIng	
  with	
  Windows
•  App	
  development	
  very	
  similar	
  to	
  building	
  
   a	
  .NET	
  app:	
  can	
  be	
  constructed	
  using	
  C#,	
  
   visual	
  basic,	
  JS	
  or	
  C++	
  
•  Heavy	
  usage	
  of	
  XML-­‐based	
  grammar	
  XAML
.NET	
  Role	
  under	
  Win8	
  
•  In	
  addiIon	
  of	
  using	
  Windows.*	
  namespaces	
  
   you	
  can	
  use	
  large	
  subset	
  of	
  .NET	
  plaAorm	
  
•  We	
  are	
  not	
  focusing	
  on	
  this,	
  but	
  exclusively	
  
   on	
  .NET	
  
VISUAL	
  STUDIO	
  TIPS	
  
Visual	
  Studio	
  Tips	
  
•  Refer	
  to	
  external	
  assemblies?	
  
    –  VIEW	
  >	
  SoluIon	
  Explorer	
  
•  UIliIty	
  for	
  invesIgaIng	
  assemblies	
  
    –  VIEW	
  >	
  Object	
  Browser	
  UIlity	
  
•  Project	
  properIes?	
  
    –  VIEW	
  >	
  SoluIon	
  Explorer	
  >	
  ProperIes	
  
•  Class	
  Tree	
  View?	
  
    –  VIEW	
  >	
  Class	
  View	
  
Code	
  Refactoring	
  and	
  Snippets	
  
•  Right	
  click	
  on	
  code	
  and	
  choose	
  refactor	
  
    –  Extract	
  method	
  
    –  Encapsulate	
  Field	
  
    –  Extract	
  Interface	
  
    –  …	
  
•  When	
  wriIng	
  code,	
  VS	
  make	
  suggesIons.	
  
   When	
  finding	
  the	
  right	
  one,	
  press	
  tab	
  twice.	
  
    –  Press	
  esc	
  to	
  exit	
  
DocumentaIon	
  
•  .NET	
  Framework	
  4.5	
  documentaIon	
  available	
  
   online:	
  
   –  h_p://msdn.microso=.com/library	
  
   –  Use	
  the	
  tree	
  hierarchy	
  leE	
  to	
  navigate	
  
Almost	
  the	
  Same	
  but	
  Not	
  Quite	
  

C#	
  
Keywords	
  
•  Single	
  rooted	
  class	
  hierarchy:	
  all	
  objects	
  
   inheritate	
  System.Object	
  
•  Almost	
  every	
  keyword	
  in	
  Java	
  can	
  be	
  found	
  
   from	
  C#	
  
    –  super                            ->   base
    –  instanceof                       ->   is
    –  import                           ->   using
    –  extends / implements             ->   :
•  Otherwise,	
  pre_y	
  much	
  the	
  same	
  
Memory	
  Handling	
  and	
  RunIme	
  
•  Memory	
  Handling	
  
   –  Most	
  objects	
  in	
  C#	
  to	
  heap	
  using	
  new	
  
   –  CLR	
  handles	
  garbage	
  collecIons	
  
•  RunIme	
  
   –  C#	
  is	
  compiled	
  to	
  intermediate	
  langage	
  (IL)	
  
   –  IL	
  runs	
  on	
  top	
  of	
  CLR	
  
   –  IL	
  code	
  is	
  always	
  naIvely	
  compiled	
  before	
  running	
  
using System;

class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine("Hello");
        Console.ReadLine();
    }
}
using System;

class Program
{
    static int Main(string[] args)
    {
        Console.WriteLine("Hello");
        Console.ReadLine();

        return -1;
    }
}
using System;

class Program
{
    static int Main()
    {
        Console.WriteLine("Hello");
        Console.ReadLine();
    }
}
System.Console	
  
•    WriteLine(),	
  ReadLine()	
  
•    Beep()	
  
•    BackgroundColor	
  
•    ForegroundColor	
  
•    Title	
  
•    WindowHeight	
  /	
  Width	
  /	
  Top	
  /	
  Le=	
  
•    Clear	
  
Formatng	
  Console	
  Output	
  
•  Supports	
  prinT()	
  statement	
  of	
  C.	
  
    –  Console.WriteLine(“Hello	
  {0}!	
  You	
  are	
  {1}	
  years	
  old”,	
  
       userName,	
  userAge);	
  
•  Can	
  use	
  formatng	
  
    –  //	
  000099999	
  
    –  Console.WriteLine(“{0:d9}”,	
  99999);	
  
    –  c,	
  format	
  currency	
  
    –  d,	
  format	
  decimal	
  numbers	
  
    –  f,	
  format	
  fixed	
  point	
  	
  
•  Can	
  be	
  used	
  also	
  in	
  Strings:	
  
    –  string	
  message	
  =	
  string.Format(“{0:d9}”,	
  99999);	
  
Data	
  Types	
  
•  Datatypes	
  are	
  “snippets”	
  for	
  full	
  blown	
  types	
  
   in	
  namespaces!	
  
•  bool	
  =>	
  System.Boolean	
  
•  byte	
  =>	
  System.Byte	
  
•  short,	
  int,	
  long,	
  char,	
  float,	
  double,	
  decimal	
  
   (128	
  bit),	
  string,	
  Object	
  
•  So	
  this	
  works!	
  
   –  Console.Write(12.toString());	
  
Members	
  of	
  Datatypes	
  
•    int.MaxValue	
  
•    int.MinValue	
  
•    double.maxValue	
  
•    double.minValue	
  
•    char.isDigit(myChar)	
  
•    char.isLe_er(myChar)	
  
•    bool	
  b	
  =	
  bool.Parse(“true”);	
  
•    double	
  d	
  =	
  double.Parse(“99.9”);	
  
String	
  
•    Length	
  
•    Compare()	
  
•    Equals()	
  
•    Format()	
  
•    Insert()	
  
•    Remove()	
  
•    Replace()	
  
•    Trim()…	
  
VerbaIm	
  Strings	
  
String longstring = @”this is
    a very long string
       as you can see”;

Console.WriteLine(longstring);
Comparing	
  
•  Usually	
  we	
  compare	
  memory	
  addresses	
  
    –  object1	
  ==	
  object2	
  
•  When	
  using	
  strings,	
  this	
  is	
  not	
  the	
  case.	
  You	
  
   can	
  compare	
  strings	
  like	
  this	
  (unlike	
  in	
  Java)	
  
    –  string1	
  ==	
  string2	
  
Immutable	
  
•  Strings	
  are	
  immutable!	
  Once	
  assigned	
  it	
  
   cannot	
  be	
  changed..	
  
    –  String	
  newString	
  =	
  original.toUpper();	
  
•  Even	
  in	
  here	
  
    –  string	
  s1	
  =	
  “a”;	
  
    –  s1	
  =	
  “b”;	
  
•  A	
  new	
  string	
  is	
  created!	
  
•  When	
  use	
  of	
  heavy	
  textual	
  data,	
  don’t	
  use	
  
   strings.	
  	
  Use	
  StringBuilder.	
  
Implicitly	
  typed	
  variables	
  
•  Usually	
  we	
  do	
  this	
  
    –  int	
  a	
  =	
  5;	
  
    –  bool	
  b	
  =	
  true;	
  
•  But	
  we	
  can	
  do	
  also	
  
    –  var	
  a	
  =	
  5;	
  
    –  var	
  b	
  =	
  true;	
  
•  Why?	
  Think	
  of	
  this:	
  
    –  var	
  c	
  =	
  SomeMethod();	
  
C#	
  For	
  each	
  
string [] array = {“a”, “b”, “c”};
foreach(string c in array) {
    Console.WriteLine(c);
}

Más contenido relacionado

La actualidad más candente

Low Level Exploits
Low Level ExploitsLow Level Exploits
Low Level Exploitshughpearse
 
Exploit techniques and mitigation
Exploit techniques and mitigationExploit techniques and mitigation
Exploit techniques and mitigationYaniv Shani
 
Apache thrift-RPC service cross languages
Apache thrift-RPC service cross languagesApache thrift-RPC service cross languages
Apache thrift-RPC service cross languagesJimmy Lai
 
Introduction to Python.Net
Introduction to Python.NetIntroduction to Python.Net
Introduction to Python.NetStefan Schukat
 
Introduction to column oriented databases in PHP
Introduction to column oriented databases in PHPIntroduction to column oriented databases in PHP
Introduction to column oriented databases in PHPZend by Rogue Wave Software
 
Why scala is not my ideal language and what I can do with this
Why scala is not my ideal language and what I can do with thisWhy scala is not my ideal language and what I can do with this
Why scala is not my ideal language and what I can do with thisRuslan Shevchenko
 
LLVM Compiler - Link Time Optimization
LLVM Compiler - Link Time OptimizationLLVM Compiler - Link Time Optimization
LLVM Compiler - Link Time OptimizationVivek Pansara
 
Introduction to Thrift
Introduction to ThriftIntroduction to Thrift
Introduction to ThriftDvir Volk
 
Building Quality Code That Lasts: A Dropbox Story. Ashley Nelson-Hornstein
 Building Quality Code That Lasts: A Dropbox Story. Ashley Nelson-Hornstein Building Quality Code That Lasts: A Dropbox Story. Ashley Nelson-Hornstein
Building Quality Code That Lasts: A Dropbox Story. Ashley Nelson-HornsteinYandex
 
Cs1123 11 pointers
Cs1123 11 pointersCs1123 11 pointers
Cs1123 11 pointersTAlha MAlik
 
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019corehard_by
 
Reviewing CPAN modules
Reviewing CPAN modulesReviewing CPAN modules
Reviewing CPAN modulesneilbowers
 
Taming the resource tiger
Taming the resource tigerTaming the resource tiger
Taming the resource tigerElizabeth Smith
 
Apache Avro in LivePerson [Hebrew]
Apache Avro in LivePerson [Hebrew]Apache Avro in LivePerson [Hebrew]
Apache Avro in LivePerson [Hebrew]LivePerson
 

La actualidad más candente (19)

Csc240 -lecture_3
Csc240  -lecture_3Csc240  -lecture_3
Csc240 -lecture_3
 
#Code2Create: Python Basics
#Code2Create: Python Basics#Code2Create: Python Basics
#Code2Create: Python Basics
 
Compilation
CompilationCompilation
Compilation
 
Low Level Exploits
Low Level ExploitsLow Level Exploits
Low Level Exploits
 
Exploit techniques and mitigation
Exploit techniques and mitigationExploit techniques and mitigation
Exploit techniques and mitigation
 
Apache thrift-RPC service cross languages
Apache thrift-RPC service cross languagesApache thrift-RPC service cross languages
Apache thrift-RPC service cross languages
 
Introduction to Python.Net
Introduction to Python.NetIntroduction to Python.Net
Introduction to Python.Net
 
Introduction to column oriented databases in PHP
Introduction to column oriented databases in PHPIntroduction to column oriented databases in PHP
Introduction to column oriented databases in PHP
 
Why scala is not my ideal language and what I can do with this
Why scala is not my ideal language and what I can do with thisWhy scala is not my ideal language and what I can do with this
Why scala is not my ideal language and what I can do with this
 
IDLs
IDLsIDLs
IDLs
 
LLVM Compiler - Link Time Optimization
LLVM Compiler - Link Time OptimizationLLVM Compiler - Link Time Optimization
LLVM Compiler - Link Time Optimization
 
Introduction to Thrift
Introduction to ThriftIntroduction to Thrift
Introduction to Thrift
 
Building Quality Code That Lasts: A Dropbox Story. Ashley Nelson-Hornstein
 Building Quality Code That Lasts: A Dropbox Story. Ashley Nelson-Hornstein Building Quality Code That Lasts: A Dropbox Story. Ashley Nelson-Hornstein
Building Quality Code That Lasts: A Dropbox Story. Ashley Nelson-Hornstein
 
Cs1123 11 pointers
Cs1123 11 pointersCs1123 11 pointers
Cs1123 11 pointers
 
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
 
Avro intro
Avro introAvro intro
Avro intro
 
Reviewing CPAN modules
Reviewing CPAN modulesReviewing CPAN modules
Reviewing CPAN modules
 
Taming the resource tiger
Taming the resource tigerTaming the resource tiger
Taming the resource tiger
 
Apache Avro in LivePerson [Hebrew]
Apache Avro in LivePerson [Hebrew]Apache Avro in LivePerson [Hebrew]
Apache Avro in LivePerson [Hebrew]
 

Destacado

Vygotskys socio cultural theory
Vygotskys socio cultural theory Vygotskys socio cultural theory
Vygotskys socio cultural theory vxiiayah
 
Automated code review process
Automated code review processAutomated code review process
Automated code review processSandesh Sharma
 
Procedimiento EXENCION MÓDULO PRÁCTICAS
Procedimiento EXENCION MÓDULO PRÁCTICAS Procedimiento EXENCION MÓDULO PRÁCTICAS
Procedimiento EXENCION MÓDULO PRÁCTICAS Josep Sirera Garrigós
 
Caterware case-study-cutty-sark
Caterware case-study-cutty-sarkCaterware case-study-cutty-sark
Caterware case-study-cutty-sarkNigel Brown
 
Programación Feria del Banano - Apartadó, Antioquia
Programación Feria del Banano - Apartadó, AntioquiaProgramación Feria del Banano - Apartadó, Antioquia
Programación Feria del Banano - Apartadó, AntioquiaJoel Romaña Pacheco
 
Actividad de laboratorio #2
Actividad de laboratorio #2Actividad de laboratorio #2
Actividad de laboratorio #2Axel554
 
stephen motau Referee form 2016
stephen motau Referee form 2016stephen motau Referee form 2016
stephen motau Referee form 2016Stephen M
 
Six week industrial training presentation BY GUPTA TARUN
Six week industrial training presentation BY GUPTA TARUNSix week industrial training presentation BY GUPTA TARUN
Six week industrial training presentation BY GUPTA TARUNTarun2222
 
Principles of Communication
Principles of CommunicationPrinciples of Communication
Principles of CommunicationLifesPurple
 
Sunitha resume Apr 2016
Sunitha resume Apr 2016Sunitha resume Apr 2016
Sunitha resume Apr 2016Sunitha Suni
 
COMMUNICATION PROCESS
COMMUNICATION PROCESSCOMMUNICATION PROCESS
COMMUNICATION PROCESSharshalii
 
akamai's [state of internet] / security
akamai's [state of internet] / securityakamai's [state of internet] / security
akamai's [state of internet] / securityThe Internet of Things
 
C# conventions & good practices
C# conventions & good practicesC# conventions & good practices
C# conventions & good practicesTan Tran
 
تحديد مدى نجاح عملية ومنتج التصميم التعليمي
تحديد مدى نجاح عملية ومنتج التصميم التعليمي تحديد مدى نجاح عملية ومنتج التصميم التعليمي
تحديد مدى نجاح عملية ومنتج التصميم التعليمي arwa88
 

Destacado (20)

Vygotskys socio cultural theory
Vygotskys socio cultural theory Vygotskys socio cultural theory
Vygotskys socio cultural theory
 
inheritance
inheritanceinheritance
inheritance
 
Little red ridding
Little red riddingLittle red ridding
Little red ridding
 
Automated code review process
Automated code review processAutomated code review process
Automated code review process
 
Procedimiento EXENCION MÓDULO PRÁCTICAS
Procedimiento EXENCION MÓDULO PRÁCTICAS Procedimiento EXENCION MÓDULO PRÁCTICAS
Procedimiento EXENCION MÓDULO PRÁCTICAS
 
Caterware case-study-cutty-sark
Caterware case-study-cutty-sarkCaterware case-study-cutty-sark
Caterware case-study-cutty-sark
 
0137_Whisky_vis1
0137_Whisky_vis10137_Whisky_vis1
0137_Whisky_vis1
 
Programación Feria del Banano - Apartadó, Antioquia
Programación Feria del Banano - Apartadó, AntioquiaProgramación Feria del Banano - Apartadó, Antioquia
Programación Feria del Banano - Apartadó, Antioquia
 
Screenstretch
ScreenstretchScreenstretch
Screenstretch
 
Actividad de laboratorio #2
Actividad de laboratorio #2Actividad de laboratorio #2
Actividad de laboratorio #2
 
stephen motau Referee form 2016
stephen motau Referee form 2016stephen motau Referee form 2016
stephen motau Referee form 2016
 
Six week industrial training presentation BY GUPTA TARUN
Six week industrial training presentation BY GUPTA TARUNSix week industrial training presentation BY GUPTA TARUN
Six week industrial training presentation BY GUPTA TARUN
 
Principles of Communication
Principles of CommunicationPrinciples of Communication
Principles of Communication
 
Sunitha resume Apr 2016
Sunitha resume Apr 2016Sunitha resume Apr 2016
Sunitha resume Apr 2016
 
Microsoft Access
Microsoft AccessMicrosoft Access
Microsoft Access
 
COMMUNICATION PROCESS
COMMUNICATION PROCESSCOMMUNICATION PROCESS
COMMUNICATION PROCESS
 
akamai's [state of internet] / security
akamai's [state of internet] / securityakamai's [state of internet] / security
akamai's [state of internet] / security
 
Cisco Annual Security Report
Cisco Annual Security ReportCisco Annual Security Report
Cisco Annual Security Report
 
C# conventions & good practices
C# conventions & good practicesC# conventions & good practices
C# conventions & good practices
 
تحديد مدى نجاح عملية ومنتج التصميم التعليمي
تحديد مدى نجاح عملية ومنتج التصميم التعليمي تحديد مدى نجاح عملية ومنتج التصميم التعليمي
تحديد مدى نجاح عملية ومنتج التصميم التعليمي
 

Similar a Intro to .NET and Core C#

C# Basic - Lec1 (Workshop on C# Programming: Learn to Build)
C# Basic - Lec1 (Workshop on C# Programming: Learn to Build)C# Basic - Lec1 (Workshop on C# Programming: Learn to Build)
C# Basic - Lec1 (Workshop on C# Programming: Learn to Build)Jannat Ruma
 
ASP.NET Session 3
ASP.NET Session 3ASP.NET Session 3
ASP.NET Session 3Sisir Ghosh
 
Csharp introduction
Csharp introductionCsharp introduction
Csharp introductionSireesh K
 
introduction to c #
introduction to c #introduction to c #
introduction to c #Sireesh K
 
CS4443 - Modern Programming Language - I Lecture (1)
CS4443 - Modern Programming Language - I Lecture (1)CS4443 - Modern Programming Language - I Lecture (1)
CS4443 - Modern Programming Language - I Lecture (1)Dilawar Khan
 
Introduction to .NET
Introduction to .NETIntroduction to .NET
Introduction to .NETJoni
 
C++ Windows Forms L01 - Intro
C++ Windows Forms L01 - IntroC++ Windows Forms L01 - Intro
C++ Windows Forms L01 - IntroMohammad Shaker
 
C++_programs.ppt
C++_programs.pptC++_programs.ppt
C++_programs.pptInfotech27
 
C++_programs.ppt
C++_programs.pptC++_programs.ppt
C++_programs.pptTeacherOnat
 
C++_programs.ppt
C++_programs.pptC++_programs.ppt
C++_programs.pptJayarAlejo
 
C++_programs.ppt
C++_programs.pptC++_programs.ppt
C++_programs.pptJayarAlejo
 
C++_programs.ppt
C++_programs.pptC++_programs.ppt
C++_programs.pptEPORI
 
C++ programming: Basic introduction to C++.ppt
C++ programming: Basic introduction to C++.pptC++ programming: Basic introduction to C++.ppt
C++ programming: Basic introduction to C++.pptyp02
 
Learn the java basic programming with example and syntaxchapter1-part-b.pptx
Learn the java basic programming with example and syntaxchapter1-part-b.pptxLearn the java basic programming with example and syntaxchapter1-part-b.pptx
Learn the java basic programming with example and syntaxchapter1-part-b.pptxGaytriMate
 
LECTURE 1 - Introduction to Programming.pptx
LECTURE 1 - Introduction to Programming.pptxLECTURE 1 - Introduction to Programming.pptx
LECTURE 1 - Introduction to Programming.pptxAOmaAli
 
CPlusPus
CPlusPusCPlusPus
CPlusPusrasen58
 
C# lecture 1: Introduction to Dot Net Framework
C# lecture 1: Introduction to Dot Net FrameworkC# lecture 1: Introduction to Dot Net Framework
C# lecture 1: Introduction to Dot Net FrameworkDr.Neeraj Kumar Pandey
 
C101 – Intro to Programming with C
C101 – Intro to Programming with CC101 – Intro to Programming with C
C101 – Intro to Programming with Cgpsoft_sk
 

Similar a Intro to .NET and Core C# (20)

C# Basic - Lec1 (Workshop on C# Programming: Learn to Build)
C# Basic - Lec1 (Workshop on C# Programming: Learn to Build)C# Basic - Lec1 (Workshop on C# Programming: Learn to Build)
C# Basic - Lec1 (Workshop on C# Programming: Learn to Build)
 
ASP.NET Session 3
ASP.NET Session 3ASP.NET Session 3
ASP.NET Session 3
 
Csharp introduction
Csharp introductionCsharp introduction
Csharp introduction
 
introduction to c #
introduction to c #introduction to c #
introduction to c #
 
CS4443 - Modern Programming Language - I Lecture (1)
CS4443 - Modern Programming Language - I Lecture (1)CS4443 - Modern Programming Language - I Lecture (1)
CS4443 - Modern Programming Language - I Lecture (1)
 
Introduction to .NET
Introduction to .NETIntroduction to .NET
Introduction to .NET
 
C++ Windows Forms L01 - Intro
C++ Windows Forms L01 - IntroC++ Windows Forms L01 - Intro
C++ Windows Forms L01 - Intro
 
C++_programs.ppt
C++_programs.pptC++_programs.ppt
C++_programs.ppt
 
C++_programs.ppt
C++_programs.pptC++_programs.ppt
C++_programs.ppt
 
C++_programs.ppt
C++_programs.pptC++_programs.ppt
C++_programs.ppt
 
C++_programs.ppt
C++_programs.pptC++_programs.ppt
C++_programs.ppt
 
C++_programs.ppt
C++_programs.pptC++_programs.ppt
C++_programs.ppt
 
C++_programs.ppt
C++_programs.pptC++_programs.ppt
C++_programs.ppt
 
C++ programming: Basic introduction to C++.ppt
C++ programming: Basic introduction to C++.pptC++ programming: Basic introduction to C++.ppt
C++ programming: Basic introduction to C++.ppt
 
Learn the java basic programming with example and syntaxchapter1-part-b.pptx
Learn the java basic programming with example and syntaxchapter1-part-b.pptxLearn the java basic programming with example and syntaxchapter1-part-b.pptx
Learn the java basic programming with example and syntaxchapter1-part-b.pptx
 
LECTURE 1 - Introduction to Programming.pptx
LECTURE 1 - Introduction to Programming.pptxLECTURE 1 - Introduction to Programming.pptx
LECTURE 1 - Introduction to Programming.pptx
 
CPlusPus
CPlusPusCPlusPus
CPlusPus
 
C# lecture 1: Introduction to Dot Net Framework
C# lecture 1: Introduction to Dot Net FrameworkC# lecture 1: Introduction to Dot Net Framework
C# lecture 1: Introduction to Dot Net Framework
 
C101 – Intro to Programming with C
C101 – Intro to Programming with CC101 – Intro to Programming with C
C101 – Intro to Programming with C
 
Introduction to Programming Lesson 01
Introduction to Programming Lesson 01Introduction to Programming Lesson 01
Introduction to Programming Lesson 01
 

Más de Jussi Pohjolainen

libGDX: Screens, Fonts and Preferences
libGDX: Screens, Fonts and PreferenceslibGDX: Screens, Fonts and Preferences
libGDX: Screens, Fonts and PreferencesJussi Pohjolainen
 
libGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame AnimationlibGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame AnimationJussi Pohjolainen
 
Intro to Building Android Games using libGDX
Intro to Building Android Games using libGDXIntro to Building Android Games using libGDX
Intro to Building Android Games using libGDXJussi Pohjolainen
 
Advanced JavaScript Development
Advanced JavaScript DevelopmentAdvanced JavaScript Development
Advanced JavaScript DevelopmentJussi Pohjolainen
 
libGDX: Simple Frame Animation
libGDX: Simple Frame AnimationlibGDX: Simple Frame Animation
libGDX: Simple Frame AnimationJussi Pohjolainen
 
libGDX: Simple Frame Animation
libGDX: Simple Frame AnimationlibGDX: Simple Frame Animation
libGDX: Simple Frame AnimationJussi Pohjolainen
 
Implementing a Simple Game using libGDX
Implementing a Simple Game using libGDXImplementing a Simple Game using libGDX
Implementing a Simple Game using libGDXJussi Pohjolainen
 
Building Android games using LibGDX
Building Android games using LibGDXBuilding Android games using LibGDX
Building Android games using LibGDXJussi Pohjolainen
 
Creating Asha Games: Game Pausing, Orientation, Sensors and Gestures
Creating Asha Games: Game Pausing, Orientation, Sensors and GesturesCreating Asha Games: Game Pausing, Orientation, Sensors and Gestures
Creating Asha Games: Game Pausing, Orientation, Sensors and GesturesJussi Pohjolainen
 
Creating Games for Asha - platform
Creating Games for Asha - platformCreating Games for Asha - platform
Creating Games for Asha - platformJussi Pohjolainen
 

Más de Jussi Pohjolainen (20)

Moved to Speakerdeck
Moved to SpeakerdeckMoved to Speakerdeck
Moved to Speakerdeck
 
Java Web Services
Java Web ServicesJava Web Services
Java Web Services
 
Box2D and libGDX
Box2D and libGDXBox2D and libGDX
Box2D and libGDX
 
libGDX: Screens, Fonts and Preferences
libGDX: Screens, Fonts and PreferenceslibGDX: Screens, Fonts and Preferences
libGDX: Screens, Fonts and Preferences
 
libGDX: Tiled Maps
libGDX: Tiled MapslibGDX: Tiled Maps
libGDX: Tiled Maps
 
libGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame AnimationlibGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame Animation
 
Intro to Building Android Games using libGDX
Intro to Building Android Games using libGDXIntro to Building Android Games using libGDX
Intro to Building Android Games using libGDX
 
Advanced JavaScript Development
Advanced JavaScript DevelopmentAdvanced JavaScript Development
Advanced JavaScript Development
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
 
libGDX: Scene2D
libGDX: Scene2DlibGDX: Scene2D
libGDX: Scene2D
 
libGDX: Simple Frame Animation
libGDX: Simple Frame AnimationlibGDX: Simple Frame Animation
libGDX: Simple Frame Animation
 
libGDX: Simple Frame Animation
libGDX: Simple Frame AnimationlibGDX: Simple Frame Animation
libGDX: Simple Frame Animation
 
libGDX: User Input
libGDX: User InputlibGDX: User Input
libGDX: User Input
 
Implementing a Simple Game using libGDX
Implementing a Simple Game using libGDXImplementing a Simple Game using libGDX
Implementing a Simple Game using libGDX
 
Building Android games using LibGDX
Building Android games using LibGDXBuilding Android games using LibGDX
Building Android games using LibGDX
 
Android Threading
Android ThreadingAndroid Threading
Android Threading
 
Creating Asha Games: Game Pausing, Orientation, Sensors and Gestures
Creating Asha Games: Game Pausing, Orientation, Sensors and GesturesCreating Asha Games: Game Pausing, Orientation, Sensors and Gestures
Creating Asha Games: Game Pausing, Orientation, Sensors and Gestures
 
Creating Games for Asha - platform
Creating Games for Asha - platformCreating Games for Asha - platform
Creating Games for Asha - platform
 
Intro to Asha UI
Intro to Asha UIIntro to Asha UI
Intro to Asha UI
 

Último

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 

Último (20)

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 

Intro to .NET and Core C#

  • 1. Intro  to  .NET  and  Core  C#   Jussi  Pohjolainen  
  • 2. .NET  Framework   •  So=ware  framework  developed  by  MS   –  Runs  primarily  on  windows   •  Benefits   –  Support  for  numerous  programming  languages   –  Language  integra2on   •  You  can  mix  different  languages   –  Comprehensive  base  class  library   –  Apps  runs  on  top  of  virtual  machine   •  Support  for  other  operaIng  systems  (in  theory)   –  Great  tools:  Visual  Studio  
  • 3.
  • 5. CLI   •  CLI  is  an  open  specificaIon  that  describes   executable  code  and  runIme  environment   •  CLI  is  core  of   –  Microso=  .NET  Framework   –  Mono  (Open  Source)   –  Portable.net  (Open  Source)    
  • 6. CTS,  CLS,  CIL   •  Common  Type  System  (CTS)   –  A  set  of  data  types  and  operaIons  that  are  share  by   all  CTS-­‐compliant  programming  languages,  such  as  C#   and  VB   •  Common  Language  SpecificaIon  (CLS)   –  Set  of  base  rules  to  which  any  language  targeIng  the   CLI  should  conform.     •  Common  Intermediate  Language  (CIL)   –  Intermediate  language  that  is  abstracted  from  the   plaTorm  hardware  (In  Java:  class)  
  • 7. Mono:OSX  »  C#  File  
  • 10. Developer  Command  Prompt  for  VS2012  
  • 11. Common  Language  RunIme:  Mac   Dropbox  –   folder  
  • 12. Common  Language  RunIme:  Win   And  run   the  .exe  in   Windows!  
  • 13. Compiling  Several  Files  in  C#   C:CodeSample> csc /main:A /out:example.exe A.cs B.cs C:CodeSample> example.exe Hello World from class A C:CodeSample> csc /main:B /out:example.exe A.cs B.cs C:CodeSample> example.exe Hello World from class B
  • 14. Open  Source  DistribuIons   •  h_p://www.mono-­‐project.com   •  h_p://www.gnu.org/so=ware/dotgnu/ pnet.html  
  • 15. IDEs   •  You  can  compile  and  run  apps  in  commandline   –  Several  good  text  editors:  notepad++,  sublime   text,  emacs   •  SharpDevelop   –  Open  source  IDE  for  .NET   •  MS  Visual  Studio  Express   –  Object  browsing  tools,  GUI  ediIng,  Intellisense  
  • 17. C#   •  C#  is  very  similar  to  Java   –  C#,  Java,  ObjecIve-­‐C  and  C++  are  a  member  of  C   family  of  programming  languages   •  C#  provides  more  syntax  than  Java,  although   Java  7  (and  upcoming  8)  is  “catching  up”   •  In  this  course,  we  focus  on  C#  (instead  of   other  CIL  complient  languages)  
  • 18. About  Namespaces   •  Libraries  give  you  exisIng  code  to  use   •  In  .NET:  namespaces   –  Using  System.CollecIons;   –  Using  System.IO;   –  Using  System.XML;   •  System  is  not  the  root,  you  may  find  namespaces   like  Microso=  that  provides  services  unique  to   Windows  (can’t  run  on  other  systems)   •  Namespaces  are  linked  to  files,  assemblies.  One   assembly  (mscorlib.dll)  can  contain  number  of   namespaces.  
  • 20. Adding  a  Assembly  in  VS   •  When  wriIng   –  Using  System.Windows.Forms;   •  This  uses  a  assembly   System.Windows.Forms.dll   •  You  must  add  this  as  a  reference  in  your   project!   •  How?   –  In  VS:  SoluIon  Explorer  >  References  >  Add   Reference  
  • 21. C#   using System; class MyApp { public static void Main() { Calculator c = new Calculator(); Console.Write(c.calculate(5,5)); } } class Calculator { public int calculate(int a, int b) { return a + b; } }
  • 23. About  Windows  8   •  Visual  Studio  2012  provides  templates  for  Win   8  app  development   •  EnIrely  new  runIme:  Windows  Run2me   (WinRT)   •  New  namespaces,  starIng  with  Windows •  App  development  very  similar  to  building   a  .NET  app:  can  be  constructed  using  C#,   visual  basic,  JS  or  C++   •  Heavy  usage  of  XML-­‐based  grammar  XAML
  • 24. .NET  Role  under  Win8   •  In  addiIon  of  using  Windows.*  namespaces   you  can  use  large  subset  of  .NET  plaAorm   •  We  are  not  focusing  on  this,  but  exclusively   on  .NET  
  • 26. Visual  Studio  Tips   •  Refer  to  external  assemblies?   –  VIEW  >  SoluIon  Explorer   •  UIliIty  for  invesIgaIng  assemblies   –  VIEW  >  Object  Browser  UIlity   •  Project  properIes?   –  VIEW  >  SoluIon  Explorer  >  ProperIes   •  Class  Tree  View?   –  VIEW  >  Class  View  
  • 27. Code  Refactoring  and  Snippets   •  Right  click  on  code  and  choose  refactor   –  Extract  method   –  Encapsulate  Field   –  Extract  Interface   –  …   •  When  wriIng  code,  VS  make  suggesIons.   When  finding  the  right  one,  press  tab  twice.   –  Press  esc  to  exit  
  • 28. DocumentaIon   •  .NET  Framework  4.5  documentaIon  available   online:   –  h_p://msdn.microso=.com/library   –  Use  the  tree  hierarchy  leE  to  navigate  
  • 29. Almost  the  Same  but  Not  Quite   C#  
  • 30. Keywords   •  Single  rooted  class  hierarchy:  all  objects   inheritate  System.Object   •  Almost  every  keyword  in  Java  can  be  found   from  C#   –  super -> base –  instanceof -> is –  import -> using –  extends / implements -> : •  Otherwise,  pre_y  much  the  same  
  • 31. Memory  Handling  and  RunIme   •  Memory  Handling   –  Most  objects  in  C#  to  heap  using  new   –  CLR  handles  garbage  collecIons   •  RunIme   –  C#  is  compiled  to  intermediate  langage  (IL)   –  IL  runs  on  top  of  CLR   –  IL  code  is  always  naIvely  compiled  before  running  
  • 32. using System; class Program { static void Main(string[] args) { Console.WriteLine("Hello"); Console.ReadLine(); } }
  • 33. using System; class Program { static int Main(string[] args) { Console.WriteLine("Hello"); Console.ReadLine(); return -1; } }
  • 34. using System; class Program { static int Main() { Console.WriteLine("Hello"); Console.ReadLine(); } }
  • 35. System.Console   •  WriteLine(),  ReadLine()   •  Beep()   •  BackgroundColor   •  ForegroundColor   •  Title   •  WindowHeight  /  Width  /  Top  /  Le=   •  Clear  
  • 36. Formatng  Console  Output   •  Supports  prinT()  statement  of  C.   –  Console.WriteLine(“Hello  {0}!  You  are  {1}  years  old”,   userName,  userAge);   •  Can  use  formatng   –  //  000099999   –  Console.WriteLine(“{0:d9}”,  99999);   –  c,  format  currency   –  d,  format  decimal  numbers   –  f,  format  fixed  point     •  Can  be  used  also  in  Strings:   –  string  message  =  string.Format(“{0:d9}”,  99999);  
  • 37. Data  Types   •  Datatypes  are  “snippets”  for  full  blown  types   in  namespaces!   •  bool  =>  System.Boolean   •  byte  =>  System.Byte   •  short,  int,  long,  char,  float,  double,  decimal   (128  bit),  string,  Object   •  So  this  works!   –  Console.Write(12.toString());  
  • 38. Members  of  Datatypes   •  int.MaxValue   •  int.MinValue   •  double.maxValue   •  double.minValue   •  char.isDigit(myChar)   •  char.isLe_er(myChar)   •  bool  b  =  bool.Parse(“true”);   •  double  d  =  double.Parse(“99.9”);  
  • 39. String   •  Length   •  Compare()   •  Equals()   •  Format()   •  Insert()   •  Remove()   •  Replace()   •  Trim()…  
  • 40. VerbaIm  Strings   String longstring = @”this is a very long string as you can see”; Console.WriteLine(longstring);
  • 41. Comparing   •  Usually  we  compare  memory  addresses   –  object1  ==  object2   •  When  using  strings,  this  is  not  the  case.  You   can  compare  strings  like  this  (unlike  in  Java)   –  string1  ==  string2  
  • 42. Immutable   •  Strings  are  immutable!  Once  assigned  it   cannot  be  changed..   –  String  newString  =  original.toUpper();   •  Even  in  here   –  string  s1  =  “a”;   –  s1  =  “b”;   •  A  new  string  is  created!   •  When  use  of  heavy  textual  data,  don’t  use   strings.    Use  StringBuilder.  
  • 43. Implicitly  typed  variables   •  Usually  we  do  this   –  int  a  =  5;   –  bool  b  =  true;   •  But  we  can  do  also   –  var  a  =  5;   –  var  b  =  true;   •  Why?  Think  of  this:   –  var  c  =  SomeMethod();  
  • 44. C#  For  each   string [] array = {“a”, “b”, “c”}; foreach(string c in array) { Console.WriteLine(c); }