SlideShare une entreprise Scribd logo
1  sur  46
Alexandre Marreiros, 2011




introduction to .Net concepts using c#
Alexandre Marreiros, 2011


Agenda
   Introduction
   .NET core framework
   CLR
   JIT Compiler
   Managed Code
   Memmory Management
   .NET & C#
   CTS
   C# language
Alexandre Marreiros, 2011


Introduction
   .NET is a framework that provides a big set of
    cross plataform technologies

   A program written in .NET can run in any system
    that has a implementation of .NET runtime;

   Includes a virtual machine runtime;

   Provides a programing API, and a unified
    language independent development framework;
Alexandre Marreiros, 2011


.NET Core Framework

       Common Language Runtime




              Framework Class Library
Alexandre Marreiros, 2011


.NET Core Framework



       Common Language Runtime




           Operating System
Alexandre Marreiros, 2011


.NET Core Framework


           .NET Framework


       Common Language Runtime



           Operating System
Alexandre Marreiros, 2011


.NET Core Framework

  C++   C#     VB.NET   Perl   J#   F#   …


        Common Language Specification



         .NET Framework Class Lybrary

             Common Language Runtime

                 Operating System
Alexandre Marreiros, 2011


.NET Core Framework

    ASP.NET
                                 WP7
     MVC3

    ASP .NET
   Web Forms
                    Windows
                            Silverlight WCF      WWF    EF
   Web Services      Forms

                     ADO .NET and XML

           .NET Framework (Base Class Library)

                  Common Language Runtime

                      Operating System
Alexandre Marreiros, 2011


.NET Core Framework
               Compiles




Code in                                 DLL or Exe
C#, Vb.NET …
                                        Managed Assembly

                                        (IL)



                  *more about this at .NET IL assembler, Lindin
Alexandre Marreiros, 2011


.NET Core Framework

                    CLR                      SO

          IL Code            Assembly



      Compile
                                          Runing
                                         Program




                    *more about this at .NET IL assembler, Lindin
Alexandre Marreiros, 2011


.NET Core Framework

    Source      Language             Code
                                                       Compilation
     Code       Compiler           Metadata




Native         JIT               Class                  Execution
Code         Compiler           Loader



                        *more about this at .NET IL assembler, Lindin
Alexandre Marreiros, 2011


.NET Core Framework
   Source
   code       VB             C#              C++
            Compiler       Compiler        Compiler


   MSIL     Assembly      Assembly         Assembly



             Common Language Runtime JIT Compiler




   Native   Managed        Managed         Managed     Unmanaged
   code      Code            CLR
                            Code            Code         Code




                          Operating System Services


                          *more about this at .NET IL assembler, Lindin
Alexandre Marreiros, 2011


.NET Core Framework
      Type Descriptions
        Classes
        Base classes
        Implemented interfaces
        Data members
        Methods

      Assembly Description
        Name
        Version
        Culture
         Other assemblies
         Security Permissions
         Exported Types


                          *more about this at .NET IL assembler, Lindin
Alexandre Marreiros, 2011


.NET Core Framework
              Assembly




 Bin folder                 So GAC




                  *more about this at .NET IL assembler, Lindin
Alexandre Marreiros, 2011


.NET Core Framework
   IL (MSIL or CIL) – Intermediate Language
      It is low-level (machine) language, like
        Assembler, but is Object-oriented

   CTS is a rich type system built into the CLR
     Implements various types
    And operations on those types

   CLS is a set of specifications that all languages and
    libraries need to follow
      This will ensure interoperability between languages
Alexandre Marreiros, 2011


CLR
 Operational Layer betwen the .NET app and
  the operating system;
 Manages runing code like a Virtual machine
     Threading
     Memory management
     Jit Compiling
   Code access security
     Code can be verified to be granted as type safe
     Role base security
Alexandre Marreiros, 2011


JIT Compiler

   Based on the CLR Class loader job, this
    entity is responsible for transforming IL code
    in to native code;

   Compilation ondemand when a method is
    called
Alexandre Marreiros, 2011


Managed Code
 Code that targets CLR is named as Managed
  Code
 Object oriented
 Type-Safe
 Cross Language integration
 Exception Handling
 Verioning
 Represented in MSIL
Alexandre Marreiros, 2011


Memmory Management
The CLR manages memory for managed code

    All allocations of objects and buffers made from a
     Managed Heap (keyword new)

    Unused objects and buffers are cleaned up
     automatically through Garbage Collection



                       *more about this at CLR via C#, Jeffrey Ritcher
Alexandre Marreiros, 2011


.NET & C#




            &
Alexandre Marreiros, 2011


CTS

   Any .NET language have the same
    datatypes, that are based in CTS rules



   At Binary Level all modules and elements
    writen in a .NET language are compatible
Alexandre Marreiros, 2011


CTS

                   .Net Types




      Value Type                ReferenceType
Alexandre Marreiros, 2011


CTS – Value Types
Most programming languages provide built-in data types, such as integers
and floating-point numbers that are copied when they are passed as
arguments (that is, they are passed by value). In the .NET Framework, these
are called value type.

ValueTypes are always passed by copy between methods and in terms of
memory management they work based on a stack philosophy.
Alexandre Marreiros, 2011


CTS – Reference Types
Only acesseble by Reference, Are used as na overload to Object
Types, Their base class are always the Object Type.

Reference types store a reference to the value’s memory address and are
allocated on the heap. Reference types can be self-describing types, pointer
types, or interface types. The data type can be determined from values of
self-describing types. Self-describing types are further split into arrays and
class types. The class types are user-defined classes, boxed value
types, and delegates.
Alexandre Marreiros, 2011


     CTS-Value Types & Ref. Types

            Value Types                                  ReferenceTypes




                           Demo Value Type vs reference type


Explanation for study proposes http://msdn.microsoft.com/en-us/magazine/cc301569.aspx
Alexandre Marreiros, 2011


 CTS-Boxing and Unboxing




                                    Demo Boxing and unboxing


*Explanation for study proposeshttp://www.codeproject.com/Articles/76153/6-important-NET-concepts-Stack-heap-Value-types-re
Alexandre Marreiros, 2011


CTS – Types of strutures
   .NET defines diferent kinds of Object strutures:

     Struct

     Interface

     Class

     Abstract Class

     Static Class

     Enum
Alexandre Marreiros, 2011


CTS – objects inner concepts
   Field

   Method

   Attribute

   Propertie
Alexandre Marreiros, 2011


CTS - Visibility
   Assembly

   Private

   Protected

   Public
Alexandre Marreiros, 2011


CTS - Inheritance
 Interfaces                  Class




  Many Class                  Just 1 class
  Inheritance                 inheritance


                Class
Alexandre Marreiros, 2011




Demo first Console app
Alexandre Marreiros, 2011


CTS - Delegates
Delegates in .NET languages such as C# and are
akin to function pointers in C++. I have found that
simply being aware of this pseudonym is extremely
helpful in understanding delegates. The term helps
us to understand that delegates allow a developer
to provide a pointer to a method/function/sub etc.

But when would a developer find this to be useful?
Alexandre Marreiros, 2011


  CTS - Delegates
Declaration:
public delegate int Comparer(object obj1, object obj2);



Delegate event handler:
 public static int CompareFirstNames(object name1, object name
2)

                    Demo Delegates
Alexandre Marreiros, 2011


CTS - Events
Alexandre Marreiros, 2011


CTS - Events
   A C# event is a class member that is activated whenever the
    event it was designed for occurs. I like to use the term "fires"
    when the event is activated. Anyone interested in the event can
    register and be notified as soon as the event fires. At the time
    an event fires, registered methods will be invoked.

   Events and delegates work hand-in-hand to provide a program's
    functionality. It starts with a class that declares an event. Any
    class, including the same class that the event is declared in, may
    register one of its methods for the event. This occurs through
    a delegate, which specifies the signature of the method that is
    registered for the event. The delegate may be one of the pre-
    defined .NET delegates or one you declare yourself. Whichever
    is appropriate, you assign the delegate to the event, which
    effectively registers the method that will be called when
    theevent fires
Alexandre Marreiros, 2011


CTS - Events
Declare delegate
      public delegate void Startdelegate()

Declare Event
      public event Startdelegate StartEvent;

Register as a EventListner
       StartEvent += new Startdelegate(OnStartEvent);
Alexandre Marreiros, 2011


CTS - Events




       Demo Event
Alexandre Marreiros, 2011


C#
Now that you already now the basics of .Net Let’s explore a litle bit c#
language
Alexandre Marreiros, 2011


C#
     Simple, modern, general-purpose, object-oriented
     programming language.

     Strong type checking, array bounds
     checking, detection of attempts to use un-initialized
     variables.

     Automatic garbage collection.
Alexandre Marreiros, 2011


C#
     Support for internationalization.

     Suitable for writing applications for both hosted and
     embedded systems.

     Low memory and processing power requirements.

     There are no global variables.

     Code is compiled as managed
Alexandre Marreiros, 2011


C#
     Compare operators

               ==        Equal
               !=        Not equal
               >         Greater than
               >=        Greater than or equal to
               <         Less than
               <=        Less than or equal to
Alexandre Marreiros, 2011


C# - Decision Methods
     if( cond ){}
     else{}

     switch(s){
       case "1":
         Console.WriteLine("You entered 1");
         break;
       case "2":
         Console.WriteLine("You entered 2");
         break;
       case "3":
         Console.WriteLine("You entered 3");
         break;
       default:
         Console.WriteLine("You entered some other number");
         break;
     }
Alexandre Marreiros, 2011


C#-Loops

   for (x = 1; x <= 5; x++){}

   while (y <= 5){}

   Do{} while (y<=5);

   Foreach(object o in array);
Alexandre Marreiros, 2011


C#
     Other concepts hands on and final considerations




     Questions?
Alexandre Marreiros, 2011


References
       Books:
            CLR via c#, Richter
            .Net fundamentals, Don Box
            .Net IL assembler, Lindin

       Visit following web sites:
              .NET Framework Home Site –
               http://msdn.microsoft.com/netframework/
              The Microsoft .NET Framework Community –
               http://www.gotdotnet.com/
              Code Project – http://www.codeproject.net/
              Mono – Open Source .NET Framework – http://www.go-
               mono.org/
              Rotor – Shared Source .NET CLI –
               http://msdn.microsoft.com/net/sscli/
       Read the news groups:
              news://msnews.microsoft.com/microsoft.public.dotnet.framewor
               k
Alexandre Marreiros, 2011




Email: Amarreiros@gmail.com
Twitter: @alexmarreiros

Feel free to ask

Contenu connexe

Tendances

Introductionto .netframework by Priyanka Pinglikar
Introductionto .netframework by Priyanka PinglikarIntroductionto .netframework by Priyanka Pinglikar
Introductionto .netframework by Priyanka PinglikarPriyankaPinglikar
 
Introduction to .NET by QuontraSolutions
Introduction to .NET by QuontraSolutionsIntroduction to .NET by QuontraSolutions
Introduction to .NET by QuontraSolutionsQUONTRASOLUTIONS
 
The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)
The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)
The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)citizenmatt
 
Introduction to .net FrameWork by QuontraSolutions
Introduction to .net FrameWork by QuontraSolutionsIntroduction to .net FrameWork by QuontraSolutions
Introduction to .net FrameWork by QuontraSolutionsQuontra Solutions
 
Net Fundamentals
Net FundamentalsNet Fundamentals
Net FundamentalsAli Taki
 
Introduction to ,NET Framework
Introduction to ,NET FrameworkIntroduction to ,NET Framework
Introduction to ,NET FrameworkANURAG SINGH
 
.Net Framework Introduction
.Net Framework Introduction.Net Framework Introduction
.Net Framework IntroductionAbhishek Sahu
 
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...yazad dumasia
 
Common language runtime clr
Common language runtime clrCommon language runtime clr
Common language runtime clrSanSan149
 
Dot net-interview-questions-and-answers part i
Dot net-interview-questions-and-answers part iDot net-interview-questions-and-answers part i
Dot net-interview-questions-and-answers part iRakesh Joshi
 
Dot net-interview-questions-and-answers part i
Dot net-interview-questions-and-answers part iDot net-interview-questions-and-answers part i
Dot net-interview-questions-and-answers part iRakesh Joshi
 
Microsoft dot net framework
Microsoft dot net frameworkMicrosoft dot net framework
Microsoft dot net frameworkAshish Verma
 
.Net framework interview questions
.Net framework interview questions.Net framework interview questions
.Net framework interview questionsMir Majid
 
DotNet Introduction
DotNet IntroductionDotNet Introduction
DotNet IntroductionWei Sun
 

Tendances (20)

Introductionto .netframework by Priyanka Pinglikar
Introductionto .netframework by Priyanka PinglikarIntroductionto .netframework by Priyanka Pinglikar
Introductionto .netframework by Priyanka Pinglikar
 
Introduction to .NET by QuontraSolutions
Introduction to .NET by QuontraSolutionsIntroduction to .NET by QuontraSolutions
Introduction to .NET by QuontraSolutions
 
The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)
The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)
The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)
 
Introduction to .net FrameWork by QuontraSolutions
Introduction to .net FrameWork by QuontraSolutionsIntroduction to .net FrameWork by QuontraSolutions
Introduction to .net FrameWork by QuontraSolutions
 
Introduction to .net
Introduction to .netIntroduction to .net
Introduction to .net
 
Net Fundamentals
Net FundamentalsNet Fundamentals
Net Fundamentals
 
Introduction to ,NET Framework
Introduction to ,NET FrameworkIntroduction to ,NET Framework
Introduction to ,NET Framework
 
.Net Framework Introduction
.Net Framework Introduction.Net Framework Introduction
.Net Framework Introduction
 
Dotnet basics
Dotnet basicsDotnet basics
Dotnet basics
 
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
 
1.Philosophy of .NET
1.Philosophy of .NET1.Philosophy of .NET
1.Philosophy of .NET
 
.Net framework
.Net framework.Net framework
.Net framework
 
Common language runtime clr
Common language runtime clrCommon language runtime clr
Common language runtime clr
 
Dot net-interview-questions-and-answers part i
Dot net-interview-questions-and-answers part iDot net-interview-questions-and-answers part i
Dot net-interview-questions-and-answers part i
 
Dot net-interview-questions-and-answers part i
Dot net-interview-questions-and-answers part iDot net-interview-questions-and-answers part i
Dot net-interview-questions-and-answers part i
 
Microsoft dot net framework
Microsoft dot net frameworkMicrosoft dot net framework
Microsoft dot net framework
 
VB.net
VB.netVB.net
VB.net
 
.Net framework interview questions
.Net framework interview questions.Net framework interview questions
.Net framework interview questions
 
.Net slid
.Net slid.Net slid
.Net slid
 
DotNet Introduction
DotNet IntroductionDotNet Introduction
DotNet Introduction
 

Similaire à .Net & c#

.Net Framework
.Net Framework.Net Framework
.Net FrameworkMohamadKrm
 
Chapter 1 introduction to .net
Chapter 1 introduction to .netChapter 1 introduction to .net
Chapter 1 introduction to .netRahul Bhoge
 
Microsoft .NET Platform
Microsoft .NET PlatformMicrosoft .NET Platform
Microsoft .NET PlatformPeter R. Egli
 
Nakov dot net-framework-overview-english
Nakov dot net-framework-overview-englishNakov dot net-framework-overview-english
Nakov dot net-framework-overview-englishsrivathsan.10
 
Dotnet interview qa
Dotnet interview qaDotnet interview qa
Dotnet interview qaabcxyzqaz
 
.NET Overview
.NET Overview.NET Overview
.NET OverviewGreg Sohl
 
Introduction to .net framework
Introduction to .net frameworkIntroduction to .net framework
Introduction to .net frameworkArun Prasad
 
04 iec t1_s1_oo_ps_session_05
04 iec t1_s1_oo_ps_session_0504 iec t1_s1_oo_ps_session_05
04 iec t1_s1_oo_ps_session_05Niit Care
 
Microsoft dot net framework
Microsoft dot net frameworkMicrosoft dot net framework
Microsoft dot net frameworkInstantenigma
 
.Net overview|Introduction Of .net
.Net overview|Introduction Of .net.Net overview|Introduction Of .net
.Net overview|Introduction Of .netpinky singh
 
Presentation1
Presentation1Presentation1
Presentation1kpkcsc
 
1..Net Framework Architecture-(c#)
1..Net Framework Architecture-(c#)1..Net Framework Architecture-(c#)
1..Net Framework Architecture-(c#)Shoaib Ghachi
 

Similaire à .Net & c# (20)

C Sharp Jn
C Sharp JnC Sharp Jn
C Sharp Jn
 
C Sharp Jn
C Sharp JnC Sharp Jn
C Sharp Jn
 
.Net Framework
.Net Framework.Net Framework
.Net Framework
 
Chapter 1 introduction to .net
Chapter 1 introduction to .netChapter 1 introduction to .net
Chapter 1 introduction to .net
 
Microsoft .NET Platform
Microsoft .NET PlatformMicrosoft .NET Platform
Microsoft .NET Platform
 
Nakov dot net-framework-overview-english
Nakov dot net-framework-overview-englishNakov dot net-framework-overview-english
Nakov dot net-framework-overview-english
 
Microsoft.Net
Microsoft.NetMicrosoft.Net
Microsoft.Net
 
Dotnet interview qa
Dotnet interview qaDotnet interview qa
Dotnet interview qa
 
.NET Overview
.NET Overview.NET Overview
.NET Overview
 
Dot net
Dot netDot net
Dot net
 
Introduction to .net framework
Introduction to .net frameworkIntroduction to .net framework
Introduction to .net framework
 
04 iec t1_s1_oo_ps_session_05
04 iec t1_s1_oo_ps_session_0504 iec t1_s1_oo_ps_session_05
04 iec t1_s1_oo_ps_session_05
 
Microsoft dot net framework
Microsoft dot net frameworkMicrosoft dot net framework
Microsoft dot net framework
 
.Net overview|Introduction Of .net
.Net overview|Introduction Of .net.Net overview|Introduction Of .net
.Net overview|Introduction Of .net
 
.Net Session Overview
.Net Session Overview.Net Session Overview
.Net Session Overview
 
Microsoft .NET Framework
Microsoft .NET FrameworkMicrosoft .NET Framework
Microsoft .NET Framework
 
Presentation1
Presentation1Presentation1
Presentation1
 
1..Net Framework Architecture-(c#)
1..Net Framework Architecture-(c#)1..Net Framework Architecture-(c#)
1..Net Framework Architecture-(c#)
 
Programming
Programming Programming
Programming
 
Part i
Part iPart i
Part i
 

Plus de Alexandre Marreiros

Xamarin devdays 2017 - PT - connected apps
Xamarin devdays 2017 - PT - connected appsXamarin devdays 2017 - PT - connected apps
Xamarin devdays 2017 - PT - connected appsAlexandre Marreiros
 
ASP.NEt MVC and Angular What a couple
ASP.NEt MVC and Angular What a coupleASP.NEt MVC and Angular What a couple
ASP.NEt MVC and Angular What a coupleAlexandre Marreiros
 
Jws masterclass progressive web apps
Jws masterclass progressive web appsJws masterclass progressive web apps
Jws masterclass progressive web appsAlexandre Marreiros
 
Quick View of Angular JS for High School
Quick View of Angular JS for High SchoolQuick View of Angular JS for High School
Quick View of Angular JS for High SchoolAlexandre Marreiros
 
Pt xug xamarin pratices on big ui consumer apps
Pt xug  xamarin pratices on big ui consumer appsPt xug  xamarin pratices on big ui consumer apps
Pt xug xamarin pratices on big ui consumer appsAlexandre Marreiros
 
Gab2015 azure search as a service
Gab2015 azure search as a serviceGab2015 azure search as a service
Gab2015 azure search as a serviceAlexandre Marreiros
 
Pragmatic responsive web design industry session 7
Pragmatic responsive web design   industry session 7Pragmatic responsive web design   industry session 7
Pragmatic responsive web design industry session 7Alexandre Marreiros
 
Universal Apps Development using HTML 5 and WINJS
Universal Apps Development using HTML 5 and WINJSUniversal Apps Development using HTML 5 and WINJS
Universal Apps Development using HTML 5 and WINJSAlexandre Marreiros
 
Windows8.1 html5 dev paradigm discussion netponto
Windows8.1 html5 dev paradigm discussion netpontoWindows8.1 html5 dev paradigm discussion netponto
Windows8.1 html5 dev paradigm discussion netpontoAlexandre Marreiros
 

Plus de Alexandre Marreiros (20)

Agular fromthetrenches2netponto
Agular fromthetrenches2netpontoAgular fromthetrenches2netponto
Agular fromthetrenches2netponto
 
Whats a Chat bot
Whats a Chat botWhats a Chat bot
Whats a Chat bot
 
Type of angular 2
Type of angular 2Type of angular 2
Type of angular 2
 
Xamarin devdays 2017 - PT - connected apps
Xamarin devdays 2017 - PT - connected appsXamarin devdays 2017 - PT - connected apps
Xamarin devdays 2017 - PT - connected apps
 
ASP.NEt MVC and Angular What a couple
ASP.NEt MVC and Angular What a coupleASP.NEt MVC and Angular What a couple
ASP.NEt MVC and Angular What a couple
 
Angular 2
Angular 2Angular 2
Angular 2
 
Jws masterclass progressive web apps
Jws masterclass progressive web appsJws masterclass progressive web apps
Jws masterclass progressive web apps
 
Xamarin.forms
Xamarin.forms Xamarin.forms
Xamarin.forms
 
Quick View of Angular JS for High School
Quick View of Angular JS for High SchoolQuick View of Angular JS for High School
Quick View of Angular JS for High School
 
Pt xug xamarin pratices on big ui consumer apps
Pt xug  xamarin pratices on big ui consumer appsPt xug  xamarin pratices on big ui consumer apps
Pt xug xamarin pratices on big ui consumer apps
 
Get satrted angular js day 2
Get satrted angular js day 2Get satrted angular js day 2
Get satrted angular js day 2
 
Get satrted angular js
Get satrted angular jsGet satrted angular js
Get satrted angular js
 
Gab2015 azure search as a service
Gab2015 azure search as a serviceGab2015 azure search as a service
Gab2015 azure search as a service
 
Pragmatic responsive web design industry session 7
Pragmatic responsive web design   industry session 7Pragmatic responsive web design   industry session 7
Pragmatic responsive web design industry session 7
 
Boot strapandresponsiveintro
Boot strapandresponsiveintroBoot strapandresponsiveintro
Boot strapandresponsiveintro
 
WebSite development using WinJS
WebSite development using WinJSWebSite development using WinJS
WebSite development using WinJS
 
Universal Apps Development using HTML 5 and WINJS
Universal Apps Development using HTML 5 and WINJSUniversal Apps Development using HTML 5 and WINJS
Universal Apps Development using HTML 5 and WINJS
 
GWAB Mobile Services
GWAB Mobile ServicesGWAB Mobile Services
GWAB Mobile Services
 
Html5ignition newweborder
Html5ignition newweborderHtml5ignition newweborder
Html5ignition newweborder
 
Windows8.1 html5 dev paradigm discussion netponto
Windows8.1 html5 dev paradigm discussion netpontoWindows8.1 html5 dev paradigm discussion netponto
Windows8.1 html5 dev paradigm discussion netponto
 

Dernier

Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 

Dernier (20)

Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 

.Net & c#

  • 1. Alexandre Marreiros, 2011 introduction to .Net concepts using c#
  • 2. Alexandre Marreiros, 2011 Agenda  Introduction  .NET core framework  CLR  JIT Compiler  Managed Code  Memmory Management  .NET & C#  CTS  C# language
  • 3. Alexandre Marreiros, 2011 Introduction  .NET is a framework that provides a big set of cross plataform technologies  A program written in .NET can run in any system that has a implementation of .NET runtime;  Includes a virtual machine runtime;  Provides a programing API, and a unified language independent development framework;
  • 4. Alexandre Marreiros, 2011 .NET Core Framework Common Language Runtime Framework Class Library
  • 5. Alexandre Marreiros, 2011 .NET Core Framework Common Language Runtime Operating System
  • 6. Alexandre Marreiros, 2011 .NET Core Framework .NET Framework Common Language Runtime Operating System
  • 7. Alexandre Marreiros, 2011 .NET Core Framework C++ C# VB.NET Perl J# F# … Common Language Specification .NET Framework Class Lybrary Common Language Runtime Operating System
  • 8. Alexandre Marreiros, 2011 .NET Core Framework ASP.NET WP7 MVC3 ASP .NET Web Forms Windows Silverlight WCF WWF EF Web Services Forms ADO .NET and XML .NET Framework (Base Class Library) Common Language Runtime Operating System
  • 9. Alexandre Marreiros, 2011 .NET Core Framework Compiles Code in DLL or Exe C#, Vb.NET … Managed Assembly (IL) *more about this at .NET IL assembler, Lindin
  • 10. Alexandre Marreiros, 2011 .NET Core Framework CLR SO IL Code Assembly Compile Runing Program *more about this at .NET IL assembler, Lindin
  • 11. Alexandre Marreiros, 2011 .NET Core Framework Source Language Code Compilation Code Compiler Metadata Native JIT Class Execution Code Compiler Loader *more about this at .NET IL assembler, Lindin
  • 12. Alexandre Marreiros, 2011 .NET Core Framework Source code VB C# C++ Compiler Compiler Compiler MSIL Assembly Assembly Assembly Common Language Runtime JIT Compiler Native Managed Managed Managed Unmanaged code Code CLR Code Code Code Operating System Services *more about this at .NET IL assembler, Lindin
  • 13. Alexandre Marreiros, 2011 .NET Core Framework Type Descriptions Classes Base classes Implemented interfaces Data members Methods Assembly Description Name Version Culture Other assemblies Security Permissions Exported Types *more about this at .NET IL assembler, Lindin
  • 14. Alexandre Marreiros, 2011 .NET Core Framework Assembly Bin folder So GAC *more about this at .NET IL assembler, Lindin
  • 15. Alexandre Marreiros, 2011 .NET Core Framework  IL (MSIL or CIL) – Intermediate Language  It is low-level (machine) language, like Assembler, but is Object-oriented  CTS is a rich type system built into the CLR  Implements various types And operations on those types  CLS is a set of specifications that all languages and libraries need to follow  This will ensure interoperability between languages
  • 16. Alexandre Marreiros, 2011 CLR  Operational Layer betwen the .NET app and the operating system;  Manages runing code like a Virtual machine  Threading  Memory management  Jit Compiling  Code access security  Code can be verified to be granted as type safe  Role base security
  • 17. Alexandre Marreiros, 2011 JIT Compiler  Based on the CLR Class loader job, this entity is responsible for transforming IL code in to native code;  Compilation ondemand when a method is called
  • 18. Alexandre Marreiros, 2011 Managed Code  Code that targets CLR is named as Managed Code  Object oriented  Type-Safe  Cross Language integration  Exception Handling  Verioning  Represented in MSIL
  • 19. Alexandre Marreiros, 2011 Memmory Management The CLR manages memory for managed code  All allocations of objects and buffers made from a Managed Heap (keyword new)  Unused objects and buffers are cleaned up automatically through Garbage Collection *more about this at CLR via C#, Jeffrey Ritcher
  • 21. Alexandre Marreiros, 2011 CTS  Any .NET language have the same datatypes, that are based in CTS rules  At Binary Level all modules and elements writen in a .NET language are compatible
  • 22. Alexandre Marreiros, 2011 CTS .Net Types Value Type ReferenceType
  • 23. Alexandre Marreiros, 2011 CTS – Value Types Most programming languages provide built-in data types, such as integers and floating-point numbers that are copied when they are passed as arguments (that is, they are passed by value). In the .NET Framework, these are called value type. ValueTypes are always passed by copy between methods and in terms of memory management they work based on a stack philosophy.
  • 24. Alexandre Marreiros, 2011 CTS – Reference Types Only acesseble by Reference, Are used as na overload to Object Types, Their base class are always the Object Type. Reference types store a reference to the value’s memory address and are allocated on the heap. Reference types can be self-describing types, pointer types, or interface types. The data type can be determined from values of self-describing types. Self-describing types are further split into arrays and class types. The class types are user-defined classes, boxed value types, and delegates.
  • 25. Alexandre Marreiros, 2011 CTS-Value Types & Ref. Types Value Types ReferenceTypes Demo Value Type vs reference type Explanation for study proposes http://msdn.microsoft.com/en-us/magazine/cc301569.aspx
  • 26. Alexandre Marreiros, 2011 CTS-Boxing and Unboxing Demo Boxing and unboxing *Explanation for study proposeshttp://www.codeproject.com/Articles/76153/6-important-NET-concepts-Stack-heap-Value-types-re
  • 27. Alexandre Marreiros, 2011 CTS – Types of strutures  .NET defines diferent kinds of Object strutures:  Struct  Interface  Class  Abstract Class  Static Class  Enum
  • 28. Alexandre Marreiros, 2011 CTS – objects inner concepts  Field  Method  Attribute  Propertie
  • 29. Alexandre Marreiros, 2011 CTS - Visibility  Assembly  Private  Protected  Public
  • 30. Alexandre Marreiros, 2011 CTS - Inheritance Interfaces Class Many Class Just 1 class Inheritance inheritance Class
  • 31. Alexandre Marreiros, 2011 Demo first Console app
  • 32. Alexandre Marreiros, 2011 CTS - Delegates Delegates in .NET languages such as C# and are akin to function pointers in C++. I have found that simply being aware of this pseudonym is extremely helpful in understanding delegates. The term helps us to understand that delegates allow a developer to provide a pointer to a method/function/sub etc. But when would a developer find this to be useful?
  • 33. Alexandre Marreiros, 2011 CTS - Delegates Declaration: public delegate int Comparer(object obj1, object obj2); Delegate event handler: public static int CompareFirstNames(object name1, object name 2) Demo Delegates
  • 35. Alexandre Marreiros, 2011 CTS - Events  A C# event is a class member that is activated whenever the event it was designed for occurs. I like to use the term "fires" when the event is activated. Anyone interested in the event can register and be notified as soon as the event fires. At the time an event fires, registered methods will be invoked.  Events and delegates work hand-in-hand to provide a program's functionality. It starts with a class that declares an event. Any class, including the same class that the event is declared in, may register one of its methods for the event. This occurs through a delegate, which specifies the signature of the method that is registered for the event. The delegate may be one of the pre- defined .NET delegates or one you declare yourself. Whichever is appropriate, you assign the delegate to the event, which effectively registers the method that will be called when theevent fires
  • 36. Alexandre Marreiros, 2011 CTS - Events Declare delegate public delegate void Startdelegate() Declare Event public event Startdelegate StartEvent; Register as a EventListner StartEvent += new Startdelegate(OnStartEvent);
  • 37. Alexandre Marreiros, 2011 CTS - Events Demo Event
  • 38. Alexandre Marreiros, 2011 C# Now that you already now the basics of .Net Let’s explore a litle bit c# language
  • 39. Alexandre Marreiros, 2011 C# Simple, modern, general-purpose, object-oriented programming language. Strong type checking, array bounds checking, detection of attempts to use un-initialized variables. Automatic garbage collection.
  • 40. Alexandre Marreiros, 2011 C# Support for internationalization. Suitable for writing applications for both hosted and embedded systems. Low memory and processing power requirements. There are no global variables. Code is compiled as managed
  • 41. Alexandre Marreiros, 2011 C# Compare operators == Equal != Not equal > Greater than >= Greater than or equal to < Less than <= Less than or equal to
  • 42. Alexandre Marreiros, 2011 C# - Decision Methods if( cond ){} else{} switch(s){ case "1": Console.WriteLine("You entered 1"); break; case "2": Console.WriteLine("You entered 2"); break; case "3": Console.WriteLine("You entered 3"); break; default: Console.WriteLine("You entered some other number"); break; }
  • 43. Alexandre Marreiros, 2011 C#-Loops for (x = 1; x <= 5; x++){} while (y <= 5){} Do{} while (y<=5); Foreach(object o in array);
  • 44. Alexandre Marreiros, 2011 C# Other concepts hands on and final considerations Questions?
  • 45. Alexandre Marreiros, 2011 References  Books:  CLR via c#, Richter  .Net fundamentals, Don Box  .Net IL assembler, Lindin  Visit following web sites:  .NET Framework Home Site – http://msdn.microsoft.com/netframework/  The Microsoft .NET Framework Community – http://www.gotdotnet.com/  Code Project – http://www.codeproject.net/  Mono – Open Source .NET Framework – http://www.go- mono.org/  Rotor – Shared Source .NET CLI – http://msdn.microsoft.com/net/sscli/  Read the news groups:  news://msnews.microsoft.com/microsoft.public.dotnet.framewor k
  • 46. Alexandre Marreiros, 2011 Email: Amarreiros@gmail.com Twitter: @alexmarreiros Feel free to ask