SlideShare a Scribd company logo
1 of 41
Introducing VC#


Objectives
  In this lesson, you will learn to:
         • Create a console application project in Visual C#
         • Create a ‘HelloWorld’ program
         • Identify the structure of a VC# program
         • Identify the compilation process and output of the VC# program
         • Implement various data types in VC#
         • Declare variables in VC# code
         • Write statements in VC# code




 ©NIIT                 Introduction to VB .NET                          Slide 1 of 41
Introducing VC#


Introduction to VC#
    •    VC# is an object-oriented language that enables you to build applications for
         the Microsoft .NET platform.
    •    You can create applications in VC#, which can be used as independent
         components for the .NET platform.
    •    VC#, as a part of the Microsoft Visual Studio .NET, has been developed as an
         extension of C++ to provide flexibility and control to a programmer.




 ©NIIT                     Introduction to VB .NET                          Slide 2 of 41
Introducing VC#


Creating a Console Application Project
in VC#
    •    The steps to create a new project in VC# are:
           • Select the File  New  Project option in the Visual Studio .NET IDE.
             Then the New Project dialog box will be displayed, as shown in the
             following figure:




 ©NIIT                    Introduction to VB .NET                         Slide 3 of 41
Introducing VC#


Creating a Console Application Project
in VC# (Contd.)
    •    In the New Project dialog box, select VC# Projects from the Project Types
         pane and Console Application from the Templates pane.




 ©NIIT                   Introduction to VB .NET                       Slide 4 of 41
Introducing VC#


Creating a Console Application Project
in VC# (Contd.)
    •    Type the name of the new project.
    •    Specify the location where the new project is to be created. You can use the
         Browse button to browse to the folder in which the new project is to be
         created.




    •    Click the OK button.
    •    When you perform these steps, two files will be created in the VC# project
         folder. They are:
           • assemblyinfo.cs file
           • class1.cs file
 ©NIIT                     Introduction to VB .NET                          Slide 5 of 41
Introducing VC#


Creating a ‘HelloWorld’ Program
    •    In order to create a ‘HelloWorld’ program in VC#, perform the following
         steps:
         • Select the View  Solution Explorer option.
         • In the Solution Explorer window, double-click the “class1.cs” file.
         • Add the following code snippet in the Main(string[] args).
                  Console.WriteLine("Hello, C#.NET World");




 ©NIIT                  Introduction to VB .NET                         Slide 6 of 41
Introducing VC#


Structure of a VC# Program
    •    The syntactical differences between VB.NET and VC# codes are listed in the
         table below:




 ©NIIT                  Introduction to VB .NET                         Slide 7 of 41
Introducing VC#


Structure of a VC# Program (Contd.)




 ©NIIT        Introduction to VB .NET   Slide 8 of 41
Introducing VC#


Structure of a VC# Program (Contd.)
    •    The Using Directive enables you to refer the classes in the namespace
         without using a fully qualified name.
    •    WriteLine() is a method, defined in the class Console, that writes text to
         standard output followed by a new line.
    •    The class Console is contained in the namespace System. The following
         code snippet applies the using directive.
     
                using System; 
                class Class1
                {
                    static void Main(string[] args)
                    {
                                Console.WriteLine 
                ("Hello, VC#.NET World!");
                    }  
                }



 ©NIIT                  Introduction to VB .NET                            Slide 9 of 41
Introducing VC#


Structure of a VC# Program (Contd.)
    •    Class Declaration
          • In VC#, you need to encapsulate a function within a class.
          • To declare a new class, the class statement is used.
    •    The Main() Function
          • The startup code is added in the Main() function.
          • An application starts with the Main() function.
          • The Main() method has a parameter, args .
          • The parameter, args, is an array that can hold a list of strings.
          • The system populates this array with strings following the program
               name entered on the command line.




 ©NIIT                 Introduction to VB .NET                       Slide 10 of 41
Introducing VC#


Compilation Process and Output of
VC# Program
    •    Select the Build option in the Build menu to compile a VC# project. The
         output window displays the error messages from the VC# compiler.
    •    Select Start Without Debugging option in the Debug menu to run the
         Hello World application.




 ©NIIT                  Introduction to VB .NET                        Slide 11 of 41
Introducing VC#

 From the Expert’s Desk
     •   This section provides:

         •    Best practices
         •    Tips and Tricks
         •    FAQs




 ©NIIT                 Introduction to VB .NET   Slide 12 of 41
Introducing VC#


Best Practices
Naming Conventions and Standards in VB.NET and
VC#
    •    Use Pascal casing for class and method names. In Pascal casing, the
         class and method names have the first character of all words are in upper-
         case and the other characters are in lower-case. For example:

          public class HelloWorld
          {
               void GetHello(string name)
               {
                   ......
               }
          }


 ©NIIT                  Introduction to VB .NET                         Slide 13 of 41
Introducing VC#


Best Practices
Naming Conventions and Standards in VB.NET and
VC# (Contd.)
    •    Use the Camel casing for variable names and method parameters. In Camel
         casing, the first character of all words, except the first character, are in
         upper case and the other characters are in lower-case. For example:
              public class HelloWorld
              {
                   int intCount = 0;
                   void GetHello(string name)
                   {
                               string someMessage = "Hello " + name;
                               ...
                   }
              }
 ©NIIT                  Introduction to VB .NET                         Slide 14 of 41
Introducing VC#


Best Practices
Good Programming
    •    Avoid large files while programming. If the codes exceed 300-400 lines then
         it is better to divide the codes into smaller classes.
    •    Avoid long methods while writing codes. On an average, a method should
         not have more than 25 lines of code. The longer methods should be divided
         into smaller chunks.
    •    Method names should be specific to the task it is suppose to perform.

         Good Practice:
               void SaveIdentityNumber ( string identityNumber )
               {
                  // Save the identity number.
               }


 ©NIIT                  Introduction to VB .NET                         Slide 15 of 41
Introducing VC#


Best Practices
Tips and Tricks
    •    Formatting Controls on a Form in VB.NET


          •    You can format controls in VB.NET by performing the following steps:


                •    Aligning Controls on a Windows Form
                •    Standardizing size of Controls
                •    Manipulating horizontal spaces and vertical spaces between
                     Controls




 ©NIIT                  Introduction to VB .NET                        Slide 16 of 41
Introducing VC#


FAQs
    •    What are the basic system requirements for programming in VC#?
         Processor
         • 450 MHz Pentium II-class processor and above
         Operating System
         • Windows XP professional
         • Windows XP Home Edition
         • Windows 2000 Professional (SP3 or above)
         • Windows 2000 Server (SP3 or above)
         • Microsoft Windows Server 2003
         Memory
         • 160 MB of RAM or above
         Hard Disk
         • 1.5 GB for installation
         • 2 GB for MSDN Library documentation
         • 500 MB of space while working
 ©NIIT                  Introduction to VB .NET                      Slide 17 of 41
Introducing VC#


FAQs (Contd.)
         Display
         • Super VGA or above
         Others
         • NET framework software development kit
         • Editor to write source code
    •    How do I get the .NET runtime?
         • You can get the .NET runtime on the Microsoft MSDN site:
             http://msdn.microsoft.com/netframework/technologyinfo/howtoget/d
             efault.aspx
         • You can also now get the framework via the Windows Update function
             of the Start menu.
             .NET also comes with Windows Server 2003, and Office 2003.




 ©NIIT                Introduction to VB .NET                     Slide 18 of 41
Introducing VC#


FAQs (Contd.)
    •    Can null be assigned to local variables?
         The Just-In-Time (JIT) compiler converts the intermediate code to native
         code so that it can execute on the target operating system. JIT keeps a
         track of lifetime of variables and analyzes when there is no need of that
         variable. Assigning null increases the lifetime of a variable.




 ©NIIT                  Introduction to VB .NET                          Slide 19 of 41
Introducing VC#


Challenge




 ©NIIT        Introduction to VB .NET   Slide 20 of 41
Introducing VC#


Challenge (Contd.)
•      Across:
       • (Across 5) A model through which security is achieved in .NET
            platform.<Abbv.> (3)
       • (Across 61) Descriptive data stored in PE along with MSIL. (3)
       • (Across 92) A compiler that compiles the portable executable.<Abbv.> (3)
       • (Across 103) A single deployable unit that contains all the information about
            the implementation of classes, structures, and interfaces. (8)
•      Down:
       • (Down 2) A directive used to reference classes in the namespace.<Abbv.>
            (5)
       • (Down 7) An architecture in which a single executable file handles all
            functions relating to the user, business, and data service layers. (10)
       • (Down 8) Help to create logical groups of related classes and interfaces. (10)
       • (Down 30) Feature that allows you to place a window against any of the
            edges of the parent window. (7)
       • (Down 84) The system that specifies the type supported by CLR.<Abbv.> (3)
    ©NIIT                  Introduction to VB .NET                        Slide 21 of 41
Introducing VC#


Solutions to Challenge




 ©NIIT        Introduction to VB .NET   Slide 22 of 41
Introducing VC#


Variables and Statements in VC#
   •     The object class is the base class of all data types. Data types represent
         the characteristics, such as size and range, of the data in memory.


   •     VC# supports two categories of data types:
         • Value Types
         • Reference Types




 ©NIIT                    Introduction to VB .NET                           Slide 23 of 41
Introducing VC#


Programming with Variables and
Statements in VC#(Contd.)
   •     Value Types are further categorized into two types:
          • Bool type
                • The bool type represents 16-bit boolean logical values, such
                     as true and false. The default value of the bool type is false.


          •    Numeric Types
                • Numeric data types are further categorized into two types:
                • Integral
                • Floating point
                • Decimal



 ©NIIT                   Introduction to VB .NET                           Slide 24 of 41
Introducing VC#


Programming with Variables and
Statements in VC#(Contd.)
   •     Reference Data Types
   •     The reference data types contain a reference of a variable of the data
         type, such as a class or a string.
         • A class type consists of data members, such as fields and constants.
              In addition, a class type consists of function members, such as
              methods, properties, and operators.


         •   The string type inherits directly from the object class. You can use
             the variables of the string type to store strings.




 ©NIIT                   Introduction to VB .NET                           Slide 25 of 41
Introducing VC#


Programming with Variables and
Statements in VC#(Contd.)
   •     Variables
          • VC# categorizes variables into three types based on their scope
               and availability. The three types of variables are:
                 • Static variables
                 • Instance variables




 ©NIIT                  Introduction to VB .NET                       Slide 26 of 41
Introducing VC#


Programming with Variables and
Statements in VC#(Contd.)
   •     Statements


   •     You can use statements to perform conditional execution in a program. C#
         provides the following statements:


   •     if statement


         •    Executes a block of code based on the value of a boolean expression.
   •     The goto statement


         •   Transfers the control to a statement that is identified by a label.



 ©NIIT                   Introduction to VB .NET                            Slide 27 of 41
Introducing VC#


Programming with Variables and
Statements in VC#(Contd.)
   •     The switch statement
          • Executes the block of code that is associated with the value of the
               controlling expression.
   •     The for statement
          • It consists of an initialization expression, a condition, and an
               increment statement. The for statement evaluates the initialization
               expression. The statement repeatedly executes the code within the
               for block until the condition is false.
   •     The for..each statement
          • It checks a condition for each element in an array.




 ©NIIT                   Introduction to VB .NET                         Slide 28 of 41
Introducing VC#


Programming with Variables and
Statements in VC#(Contd.)
   •     The while statement

         •   It conditionally executes the code within the while block zero or more
             times.

   •     the do..while statement

         •   It conditionally executes the code within the do..while block one or
             more times




 ©NIIT                   Introduction to VB .NET                         Slide 29 of 41
Introducing VC#

 From the Expert’s Desk
         •   This section provides:


             •    Best Practices
             •    Tips and Tricks
             •    FAQs




 ©NIIT                Introduction to VB .NET   Slide 30 of 41
Introducing VC#


Best Practices
Recommended Function Scope
    •    Whenever a new application is developed, all the methods defined inside the
         solution projects should be declared with the private access-modifier. This
         helps in developing a robust application. When private access-modifier is
         used in a method declaration, no object of the containing class or the
         classes derived from the containing class will be able to access the private
         method. Whenever there is a need to use a private method in derived
         classes for overriding, the private modifier can be replaced by protected
         modifier. If there is a need to call the private methods through objects of
         other classes, the private or protected modifier can be replaced by public
         modifier.




 ©NIIT                  Introduction to VB .NET                         Slide 31 of 41
Introducing VC#


Best Practices(Contd.)
Use Inheritance For Extensibility And
Maintainability
    •    You should try to create new forms and controls by inheriting through the
         existing forms and controls of the project. This helps in debugging the
         applications. Consider the example of form inheritance. It is better to create
         a base form that has items such as logos, command buttons, menus etc.
         The new forms can now inherit from this form. It will help in developing
         applications quickly. In addition, it will increase the maintainability of the
         applications because the amount of code the programmer needs to write will
         be reduced. You should also write small codes in the functions and
         procedures.




 ©NIIT                  Introduction to VB .NET                           Slide 32 of 41
Introducing VC#


Tips and Tricks
Tips on Shortcut Menus in VC#
         •   The Toolbox (Ctrl+Alt+X) window has multiple tabs. You can drag
             and drop code onto this window and copy it anywhere. Some tabs do
             not allow dropping code into them. To identify the tabs that allow
             dropping code into them can be identified through a unique icon. The
             General tab has the icon.
         •   Ctrl+- (Ctrl + Hyphen) is used to navigate through the code positions
             you visited recently. Ctrl+Shift+- is used to navigate in the opposite
             direction. Floating point
         •   Matching brace / comment / region / quote works in VC# only. Ctrl+]
             is used to find a matching brace. It can also be used to find a
             matching comment, region or quote depending upon what is pointed
             by the cursor currently.




 ©NIIT                 Introduction to VB .NET                          Slide 33 of 41
Introducing VC#


Tips and Tricks (Contd.)
Tips on Shortcut Menus in VC#
    •    Press Alt and then select the area you want to copy with your mouse.

    •    Build and Debug shortcut keys:

          •    Build - Ctrl+Shift+B
          •    Run - Ctrl+F5
          •    Debug – F5
          •    Navigate through build errors - F8




 ©NIIT                  Introduction to VB .NET                        Slide 34 of 41
Introducing VC#


FAQs
    •    Can static and instance methods be declared with the same name?

         Yes, static and instance methods be declared with the same name.
         Whenever the method will be invoked through the containing class, the
         static version of the method will be executed. In contrast, whenever the
         method will be invoked through an object of the class containing the
         methods, the instance version of the method will be executed

    •    State the difference between override and new modifiers?

          Override modifier enables a base class method to hide the derived class
         implementation of the method. In contrast, the new modifier enables a
         derived class method to hide the base class implementation of the method.




 ©NIIT                  Introduction to VB .NET                          Slide 35 of 41
Introducing VC#

FAQs (Contd.)
    •    What is the difference between managed code and unmanaged code?

           Managed code is the code that is managed by the CLR. In other words,
         managed code is written to target the CLR. All code written in Visual Basic
         and C# is managed by default. Unmanaged code, on the other hand, does
         not benefit from the features provided by the CLR, such as garbage
         collection and type safety.

    •    Is it possible to monitor the activities and performance of the CLR?

          Yes. You can use Perfmon.exe in Windows 2000 to monitor the activities
         and performance of the CLR. Expand the Performance Logs and Alerts
         node. Click on Counter Logs. Double-click System Overview. In the
         System Overview Properties dialog box, click the Add button. In the
         Select Counters dialog box, select the Performance object drop-down
         list. This list displays various objects, such as .NET CLR Interop and .NET
         CLR Memory. You can add these objects and monitor the activities and
         performance of the CLR.

 ©NIIT                   Introduction to VB .NET                          Slide 36 of 41
Introducing VC#


Challenge




 ©NIIT        Introduction to VB .NET   Slide 37 of 41
Introducing VC#

Challenge (Contd.)
    •    Across:
          • (Across 2) Which formal parameter in VC# is declared without any
              modifier? (5)
          • (Across 22) Which access-modifier restrict the methods to be
              referenced inside the program only? (9)
          • (Across 42) Which modifier is used with parameter arrays in the
              formal parameter list of a method declaration? (6)
          • (Across 112) Which methods are called through class names? (6)
    •    Down:
          • (Down 1) The method body of an external method simply consists of?
             (9)
          • (Down 2) Name the keyword used as return-type of a method that
             does not return anything. (4)




 ©NIIT                 Introduction to VB .NET                      Slide 38 of 41
Introducing VC#


Challenge (Contd.)
         •   (Down 6) Name the method-modifier which enables language
             interoperability. (6)
         •   (Down 8) Which modifier for a method prevents a derived class from
             further overriding a base class function in VC#? (6)
         •   (Down 14) What do you call a user-defined declarative information
             attached to class member declarations? (9)
         •   (Down 42) Which modifier cannot be used if virtual, override, or
             abstract modifiers are being used? (7)
         •   (Down 43) Which modifier cannot be used if the virtual modifier is
             used for a method? (8)
         •   (Down 45) What is the name given to the arguments passed in a
             method call?
         •   (Down 67) Which access-modifier enables methods to be referenced
             outside the class through objects? (6)




 ©NIIT               Introduction to VB .NET                        Slide 39 of 41
Introducing VC#


Solution to Challenge




 ©NIIT        Introduction to VB .NET   Slide 40 of 41
Introducing VC#

Summary
    •    VC# is an object-oriented language that enables you to build applications for
         the Microsoft .NET platform.
    •    You can create applications in VC#, which can be used as independent
         components for the .NET platform
    •    VC#, as a part of the Microsoft Visual Studio .NET, has been developed as
         an extension of C++ to provide flexibility and control to a programmer.
         However, VC# shares the same semantics as C++ for creating applications.
    •    There are some syntactical differences between VB.NET and VC# codes
    •    The object class is the base class of all data types. Data types represent the
         characteristics, such as size and range, of the data in memory.
    •    VC# supports two categories of data types:
          • Value Types
          • Reference Types



 ©NIIT                  Introduction to VB .NET                           Slide 41 of 41

More Related Content

What's hot

Programming With WinRT And Windows8
Programming With WinRT And Windows8Programming With WinRT And Windows8
Programming With WinRT And Windows8Rainer Stropek
 
Synapse india fundamentals of dotnet development
Synapse india fundamentals of dotnet  developmentSynapse india fundamentals of dotnet  development
Synapse india fundamentals of dotnet developmentSynapseindiappsdevelopment
 
.Net framework interview questions
.Net framework interview questions.Net framework interview questions
.Net framework interview questionsMir Majid
 
Java vs .net
Java vs .netJava vs .net
Java vs .netTech_MX
 
Visual Studio 2010 and .NET Framework 4.0 Overview
Visual Studio 2010 and .NET Framework 4.0 OverviewVisual Studio 2010 and .NET Framework 4.0 Overview
Visual Studio 2010 and .NET Framework 4.0 OverviewHarish Ranganathan
 
Introduction to .NET Framework
Introduction to .NET FrameworkIntroduction to .NET Framework
Introduction to .NET FrameworkKamlesh Makvana
 
BCA IPU VB.NET UNIT-I
BCA IPU VB.NET UNIT-IBCA IPU VB.NET UNIT-I
BCA IPU VB.NET UNIT-IVaibhavj1234
 
C++ in windows phone apps
C++ in windows phone appsC++ in windows phone apps
C++ in windows phone appsMirco Vanini
 
New microsoft office word document
New microsoft office word documentNew microsoft office word document
New microsoft office word documentSIVAJISADHANA
 

What's hot (15)

Programming With WinRT And Windows8
Programming With WinRT And Windows8Programming With WinRT And Windows8
Programming With WinRT And Windows8
 
Synapse india fundamentals of dotnet development
Synapse india fundamentals of dotnet  developmentSynapse india fundamentals of dotnet  development
Synapse india fundamentals of dotnet development
 
Java vs .net (beginners)
Java vs .net (beginners)Java vs .net (beginners)
Java vs .net (beginners)
 
Explore asp.net core 3.0 features
Explore asp.net core 3.0 featuresExplore asp.net core 3.0 features
Explore asp.net core 3.0 features
 
.Net framework interview questions
.Net framework interview questions.Net framework interview questions
.Net framework interview questions
 
Java vs .net
Java vs .netJava vs .net
Java vs .net
 
Net framework
Net frameworkNet framework
Net framework
 
Visual Studio 2010 and .NET Framework 4.0 Overview
Visual Studio 2010 and .NET Framework 4.0 OverviewVisual Studio 2010 and .NET Framework 4.0 Overview
Visual Studio 2010 and .NET Framework 4.0 Overview
 
Deep Dive into WinRT
Deep Dive into WinRTDeep Dive into WinRT
Deep Dive into WinRT
 
Vb.net class notes
Vb.net class notesVb.net class notes
Vb.net class notes
 
Introduction to .NET Framework
Introduction to .NET FrameworkIntroduction to .NET Framework
Introduction to .NET Framework
 
Dotnet basics
Dotnet basicsDotnet basics
Dotnet basics
 
BCA IPU VB.NET UNIT-I
BCA IPU VB.NET UNIT-IBCA IPU VB.NET UNIT-I
BCA IPU VB.NET UNIT-I
 
C++ in windows phone apps
C++ in windows phone appsC++ in windows phone apps
C++ in windows phone apps
 
New microsoft office word document
New microsoft office word documentNew microsoft office word document
New microsoft office word document
 

Viewers also liked

Python Tools for Visual Studio: Python na Microsoftovom .NET-u
Python Tools for Visual Studio: Python na Microsoftovom .NET-uPython Tools for Visual Studio: Python na Microsoftovom .NET-u
Python Tools for Visual Studio: Python na Microsoftovom .NET-uNikola Plejic
 
Part 8 add,update,delete records using records operation buttons in vb.net
Part 8 add,update,delete records using records operation buttons in vb.netPart 8 add,update,delete records using records operation buttons in vb.net
Part 8 add,update,delete records using records operation buttons in vb.netGirija Muscut
 
What&rsquo;s new in Visual C++
What&rsquo;s new in Visual C++What&rsquo;s new in Visual C++
What&rsquo;s new in Visual C++Microsoft
 
Part 3 binding navigator vb.net
Part 3 binding navigator vb.netPart 3 binding navigator vb.net
Part 3 binding navigator vb.netGirija Muscut
 
Pioneers of Information Science in Europe: The Oeuvre of Norbert Henrichs
Pioneers of Information Science in Europe: The Oeuvre of Norbert HenrichsPioneers of Information Science in Europe: The Oeuvre of Norbert Henrichs
Pioneers of Information Science in Europe: The Oeuvre of Norbert HenrichsWolfgang Stock
 
Part 5 create sequence increment value using negative value
Part 5 create sequence increment value using negative valuePart 5 create sequence increment value using negative value
Part 5 create sequence increment value using negative valueGirija Muscut
 
Part2 database connection service based using vb.net
Part2 database connection service based using vb.netPart2 database connection service based using vb.net
Part2 database connection service based using vb.netGirija Muscut
 
Making Information Usable: The Art & Science of Information Design
Making Information Usable: The Art & Science of Information DesignMaking Information Usable: The Art & Science of Information Design
Making Information Usable: The Art & Science of Information DesignHubbard One
 
Part 1 picturebox using vb.net
Part 1 picturebox using vb.netPart 1 picturebox using vb.net
Part 1 picturebox using vb.netGirija Muscut
 
Logical Programming With ruby-prolog
Logical Programming With ruby-prologLogical Programming With ruby-prolog
Logical Programming With ruby-prologPreston Lee
 
Debugging in visual studio (basic level)
Debugging in visual studio (basic level)Debugging in visual studio (basic level)
Debugging in visual studio (basic level)Larry Nung
 
Prolog -Cpt114 - Week3
Prolog -Cpt114 - Week3Prolog -Cpt114 - Week3
Prolog -Cpt114 - Week3a_akhavan
 
How Not To Be Seen
How Not To Be SeenHow Not To Be Seen
How Not To Be SeenMark Pesce
 
Cognitive information science
Cognitive information scienceCognitive information science
Cognitive information scienceS. Kate Devitt
 
Transforming the world with Information technology
Transforming the world with Information technologyTransforming the world with Information technology
Transforming the world with Information technologyGlenn Klith Andersen
 
RuleML2015: Explanation of proofs of regulatory (non-)complianceusing semanti...
RuleML2015: Explanation of proofs of regulatory (non-)complianceusing semanti...RuleML2015: Explanation of proofs of regulatory (non-)complianceusing semanti...
RuleML2015: Explanation of proofs of regulatory (non-)complianceusing semanti...RuleML
 

Viewers also liked (20)

Python Tools for Visual Studio: Python na Microsoftovom .NET-u
Python Tools for Visual Studio: Python na Microsoftovom .NET-uPython Tools for Visual Studio: Python na Microsoftovom .NET-u
Python Tools for Visual Studio: Python na Microsoftovom .NET-u
 
Part 8 add,update,delete records using records operation buttons in vb.net
Part 8 add,update,delete records using records operation buttons in vb.netPart 8 add,update,delete records using records operation buttons in vb.net
Part 8 add,update,delete records using records operation buttons in vb.net
 
Information Overload and Information Science / Mieczysław Muraszkiewicz
Information Overload and Information Science / Mieczysław MuraszkiewiczInformation Overload and Information Science / Mieczysław Muraszkiewicz
Information Overload and Information Science / Mieczysław Muraszkiewicz
 
What&rsquo;s new in Visual C++
What&rsquo;s new in Visual C++What&rsquo;s new in Visual C++
What&rsquo;s new in Visual C++
 
Part 3 binding navigator vb.net
Part 3 binding navigator vb.netPart 3 binding navigator vb.net
Part 3 binding navigator vb.net
 
Pioneers of Information Science in Europe: The Oeuvre of Norbert Henrichs
Pioneers of Information Science in Europe: The Oeuvre of Norbert HenrichsPioneers of Information Science in Europe: The Oeuvre of Norbert Henrichs
Pioneers of Information Science in Europe: The Oeuvre of Norbert Henrichs
 
Part 5 create sequence increment value using negative value
Part 5 create sequence increment value using negative valuePart 5 create sequence increment value using negative value
Part 5 create sequence increment value using negative value
 
Part2 database connection service based using vb.net
Part2 database connection service based using vb.netPart2 database connection service based using vb.net
Part2 database connection service based using vb.net
 
Making Information Usable: The Art & Science of Information Design
Making Information Usable: The Art & Science of Information DesignMaking Information Usable: The Art & Science of Information Design
Making Information Usable: The Art & Science of Information Design
 
Part 1 picturebox using vb.net
Part 1 picturebox using vb.netPart 1 picturebox using vb.net
Part 1 picturebox using vb.net
 
Logical Programming With ruby-prolog
Logical Programming With ruby-prologLogical Programming With ruby-prolog
Logical Programming With ruby-prolog
 
Debugging in visual studio (basic level)
Debugging in visual studio (basic level)Debugging in visual studio (basic level)
Debugging in visual studio (basic level)
 
Prolog -Cpt114 - Week3
Prolog -Cpt114 - Week3Prolog -Cpt114 - Week3
Prolog -Cpt114 - Week3
 
How Not To Be Seen
How Not To Be SeenHow Not To Be Seen
How Not To Be Seen
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Cognitive information science
Cognitive information scienceCognitive information science
Cognitive information science
 
Transforming the world with Information technology
Transforming the world with Information technologyTransforming the world with Information technology
Transforming the world with Information technology
 
Presentation1
Presentation1Presentation1
Presentation1
 
RuleML2015: Explanation of proofs of regulatory (non-)complianceusing semanti...
RuleML2015: Explanation of proofs of regulatory (non-)complianceusing semanti...RuleML2015: Explanation of proofs of regulatory (non-)complianceusing semanti...
RuleML2015: Explanation of proofs of regulatory (non-)complianceusing semanti...
 
Cpp lab 13_pres
Cpp lab 13_presCpp lab 13_pres
Cpp lab 13_pres
 

Similar to Vb.net session 15

01 Introduction to programming
01 Introduction to programming01 Introduction to programming
01 Introduction to programmingmaznabili
 
LECTURE 1 - Introduction to Programming.pptx
LECTURE 1 - Introduction to Programming.pptxLECTURE 1 - Introduction to Programming.pptx
LECTURE 1 - Introduction to Programming.pptxAOmaAli
 
01. introduction to-programming
01. introduction to-programming01. introduction to-programming
01. introduction to-programmingStoian Kirov
 
Vb.net session 03
Vb.net session 03Vb.net session 03
Vb.net session 03Niit Care
 
Wintellect - Devscovery - Portable Class Library
Wintellect - Devscovery - Portable Class LibraryWintellect - Devscovery - Portable Class Library
Wintellect - Devscovery - Portable Class LibraryJeremy Likness
 
01. Introduction to Programming
01. Introduction to Programming01. Introduction to Programming
01. Introduction to ProgrammingIntro C# Book
 
1..Net Framework Architecture-(c#)
1..Net Framework Architecture-(c#)1..Net Framework Architecture-(c#)
1..Net Framework Architecture-(c#)Shoaib Ghachi
 
Csharp Hands On Lab Paul Yao
Csharp Hands On Lab Paul YaoCsharp Hands On Lab Paul Yao
Csharp Hands On Lab Paul YaoMamgmo Magnda
 
c#.Net Windows application
c#.Net Windows application c#.Net Windows application
c#.Net Windows application veera
 
Introduction to .NET Core & ASP.NET Core MVC
Introduction to .NET Core & ASP.NET Core MVCIntroduction to .NET Core & ASP.NET Core MVC
Introduction to .NET Core & ASP.NET Core MVCSaineshwar bageri
 
21UCAC61 C# and .Net Programming.pdf(MTNC)(BCA)
21UCAC61 C# and .Net Programming.pdf(MTNC)(BCA)21UCAC61 C# and .Net Programming.pdf(MTNC)(BCA)
21UCAC61 C# and .Net Programming.pdf(MTNC)(BCA)ssuser7f90ae
 
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
 
Object Oriented Programming I
Object Oriented Programming IObject Oriented Programming I
Object Oriented Programming Iraven_rainagi
 
Introdot Netc Sharp En
Introdot Netc Sharp EnIntrodot Netc Sharp En
Introdot Netc Sharp EnGregory Renard
 
AWS Summit Auckland - Moving MS .NET Applications One Container at a Time
AWS Summit Auckland - Moving MS .NET Applications One Container at a TimeAWS Summit Auckland - Moving MS .NET Applications One Container at a Time
AWS Summit Auckland - Moving MS .NET Applications One Container at a TimeAmazon Web Services
 
Introduction to vb.net
Introduction to vb.netIntroduction to vb.net
Introduction to vb.netJaya Kumari
 

Similar to Vb.net session 15 (20)

01 Introduction to programming
01 Introduction to programming01 Introduction to programming
01 Introduction to programming
 
LECTURE 1 - Introduction to Programming.pptx
LECTURE 1 - Introduction to Programming.pptxLECTURE 1 - Introduction to Programming.pptx
LECTURE 1 - Introduction to Programming.pptx
 
01. introduction to-programming
01. introduction to-programming01. introduction to-programming
01. introduction to-programming
 
Vb.net session 03
Vb.net session 03Vb.net session 03
Vb.net session 03
 
Wintellect - Devscovery - Portable Class Library
Wintellect - Devscovery - Portable Class LibraryWintellect - Devscovery - Portable Class Library
Wintellect - Devscovery - Portable Class Library
 
About .net
About .net About .net
About .net
 
Presentation1.pptx
Presentation1.pptxPresentation1.pptx
Presentation1.pptx
 
Working in Visual Studio.Net
Working in Visual Studio.NetWorking in Visual Studio.Net
Working in Visual Studio.Net
 
01. Introduction to Programming
01. Introduction to Programming01. Introduction to Programming
01. Introduction to Programming
 
1..Net Framework Architecture-(c#)
1..Net Framework Architecture-(c#)1..Net Framework Architecture-(c#)
1..Net Framework Architecture-(c#)
 
Csharp Hands On Lab Paul Yao
Csharp Hands On Lab Paul YaoCsharp Hands On Lab Paul Yao
Csharp Hands On Lab Paul Yao
 
c#.Net Windows application
c#.Net Windows application c#.Net Windows application
c#.Net Windows application
 
Introduction to .NET Core & ASP.NET Core MVC
Introduction to .NET Core & ASP.NET Core MVCIntroduction to .NET Core & ASP.NET Core MVC
Introduction to .NET Core & ASP.NET Core MVC
 
W1.pptx
W1.pptxW1.pptx
W1.pptx
 
21UCAC61 C# and .Net Programming.pdf(MTNC)(BCA)
21UCAC61 C# and .Net Programming.pdf(MTNC)(BCA)21UCAC61 C# and .Net Programming.pdf(MTNC)(BCA)
21UCAC61 C# and .Net Programming.pdf(MTNC)(BCA)
 
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)
 
Object Oriented Programming I
Object Oriented Programming IObject Oriented Programming I
Object Oriented Programming I
 
Introdot Netc Sharp En
Introdot Netc Sharp EnIntrodot Netc Sharp En
Introdot Netc Sharp En
 
AWS Summit Auckland - Moving MS .NET Applications One Container at a Time
AWS Summit Auckland - Moving MS .NET Applications One Container at a TimeAWS Summit Auckland - Moving MS .NET Applications One Container at a Time
AWS Summit Auckland - Moving MS .NET Applications One Container at a Time
 
Introduction to vb.net
Introduction to vb.netIntroduction to vb.net
Introduction to vb.net
 

More from Niit Care (20)

Ajs 1 b
Ajs 1 bAjs 1 b
Ajs 1 b
 
Ajs 4 b
Ajs 4 bAjs 4 b
Ajs 4 b
 
Ajs 4 a
Ajs 4 aAjs 4 a
Ajs 4 a
 
Ajs 4 c
Ajs 4 cAjs 4 c
Ajs 4 c
 
Ajs 3 b
Ajs 3 bAjs 3 b
Ajs 3 b
 
Ajs 3 a
Ajs 3 aAjs 3 a
Ajs 3 a
 
Ajs 3 c
Ajs 3 cAjs 3 c
Ajs 3 c
 
Ajs 2 b
Ajs 2 bAjs 2 b
Ajs 2 b
 
Ajs 2 a
Ajs 2 aAjs 2 a
Ajs 2 a
 
Ajs 2 c
Ajs 2 cAjs 2 c
Ajs 2 c
 
Ajs 1 a
Ajs 1 aAjs 1 a
Ajs 1 a
 
Ajs 1 c
Ajs 1 cAjs 1 c
Ajs 1 c
 
Dacj 4 2-c
Dacj 4 2-cDacj 4 2-c
Dacj 4 2-c
 
Dacj 4 2-b
Dacj 4 2-bDacj 4 2-b
Dacj 4 2-b
 
Dacj 4 2-a
Dacj 4 2-aDacj 4 2-a
Dacj 4 2-a
 
Dacj 4 1-c
Dacj 4 1-cDacj 4 1-c
Dacj 4 1-c
 
Dacj 4 1-b
Dacj 4 1-bDacj 4 1-b
Dacj 4 1-b
 
Dacj 4 1-a
Dacj 4 1-aDacj 4 1-a
Dacj 4 1-a
 
Dacj 1-2 b
Dacj 1-2 bDacj 1-2 b
Dacj 1-2 b
 
Dacj 1-3 c
Dacj 1-3 cDacj 1-3 c
Dacj 1-3 c
 

Recently uploaded

SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
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
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
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
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 

Recently uploaded (20)

SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
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
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
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
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 

Vb.net session 15

  • 1. Introducing VC# Objectives In this lesson, you will learn to: • Create a console application project in Visual C# • Create a ‘HelloWorld’ program • Identify the structure of a VC# program • Identify the compilation process and output of the VC# program • Implement various data types in VC# • Declare variables in VC# code • Write statements in VC# code ©NIIT Introduction to VB .NET Slide 1 of 41
  • 2. Introducing VC# Introduction to VC# • VC# is an object-oriented language that enables you to build applications for the Microsoft .NET platform. • You can create applications in VC#, which can be used as independent components for the .NET platform. • VC#, as a part of the Microsoft Visual Studio .NET, has been developed as an extension of C++ to provide flexibility and control to a programmer. ©NIIT Introduction to VB .NET Slide 2 of 41
  • 3. Introducing VC# Creating a Console Application Project in VC# • The steps to create a new project in VC# are: • Select the File  New  Project option in the Visual Studio .NET IDE. Then the New Project dialog box will be displayed, as shown in the following figure: ©NIIT Introduction to VB .NET Slide 3 of 41
  • 4. Introducing VC# Creating a Console Application Project in VC# (Contd.) • In the New Project dialog box, select VC# Projects from the Project Types pane and Console Application from the Templates pane. ©NIIT Introduction to VB .NET Slide 4 of 41
  • 5. Introducing VC# Creating a Console Application Project in VC# (Contd.) • Type the name of the new project. • Specify the location where the new project is to be created. You can use the Browse button to browse to the folder in which the new project is to be created. • Click the OK button. • When you perform these steps, two files will be created in the VC# project folder. They are: • assemblyinfo.cs file • class1.cs file ©NIIT Introduction to VB .NET Slide 5 of 41
  • 6. Introducing VC# Creating a ‘HelloWorld’ Program • In order to create a ‘HelloWorld’ program in VC#, perform the following steps: • Select the View  Solution Explorer option. • In the Solution Explorer window, double-click the “class1.cs” file. • Add the following code snippet in the Main(string[] args). Console.WriteLine("Hello, C#.NET World"); ©NIIT Introduction to VB .NET Slide 6 of 41
  • 7. Introducing VC# Structure of a VC# Program • The syntactical differences between VB.NET and VC# codes are listed in the table below: ©NIIT Introduction to VB .NET Slide 7 of 41
  • 8. Introducing VC# Structure of a VC# Program (Contd.) ©NIIT Introduction to VB .NET Slide 8 of 41
  • 9. Introducing VC# Structure of a VC# Program (Contd.) • The Using Directive enables you to refer the classes in the namespace without using a fully qualified name. • WriteLine() is a method, defined in the class Console, that writes text to standard output followed by a new line. • The class Console is contained in the namespace System. The following code snippet applies the using directive.   using System;  class Class1 {     static void Main(string[] args)     {                 Console.WriteLine  ("Hello, VC#.NET World!");     }   } ©NIIT Introduction to VB .NET Slide 9 of 41
  • 10. Introducing VC# Structure of a VC# Program (Contd.) • Class Declaration • In VC#, you need to encapsulate a function within a class. • To declare a new class, the class statement is used. • The Main() Function • The startup code is added in the Main() function. • An application starts with the Main() function. • The Main() method has a parameter, args . • The parameter, args, is an array that can hold a list of strings. • The system populates this array with strings following the program name entered on the command line. ©NIIT Introduction to VB .NET Slide 10 of 41
  • 11. Introducing VC# Compilation Process and Output of VC# Program • Select the Build option in the Build menu to compile a VC# project. The output window displays the error messages from the VC# compiler. • Select Start Without Debugging option in the Debug menu to run the Hello World application. ©NIIT Introduction to VB .NET Slide 11 of 41
  • 12. Introducing VC# From the Expert’s Desk • This section provides: • Best practices • Tips and Tricks • FAQs ©NIIT Introduction to VB .NET Slide 12 of 41
  • 13. Introducing VC# Best Practices Naming Conventions and Standards in VB.NET and VC# • Use Pascal casing for class and method names. In Pascal casing, the class and method names have the first character of all words are in upper- case and the other characters are in lower-case. For example: public class HelloWorld { void GetHello(string name) { ...... } } ©NIIT Introduction to VB .NET Slide 13 of 41
  • 14. Introducing VC# Best Practices Naming Conventions and Standards in VB.NET and VC# (Contd.) • Use the Camel casing for variable names and method parameters. In Camel casing, the first character of all words, except the first character, are in upper case and the other characters are in lower-case. For example: public class HelloWorld { int intCount = 0; void GetHello(string name) { string someMessage = "Hello " + name; ... } } ©NIIT Introduction to VB .NET Slide 14 of 41
  • 15. Introducing VC# Best Practices Good Programming • Avoid large files while programming. If the codes exceed 300-400 lines then it is better to divide the codes into smaller classes. • Avoid long methods while writing codes. On an average, a method should not have more than 25 lines of code. The longer methods should be divided into smaller chunks. • Method names should be specific to the task it is suppose to perform. Good Practice:      void SaveIdentityNumber ( string identityNumber ) { // Save the identity number. } ©NIIT Introduction to VB .NET Slide 15 of 41
  • 16. Introducing VC# Best Practices Tips and Tricks • Formatting Controls on a Form in VB.NET • You can format controls in VB.NET by performing the following steps: • Aligning Controls on a Windows Form • Standardizing size of Controls • Manipulating horizontal spaces and vertical spaces between Controls ©NIIT Introduction to VB .NET Slide 16 of 41
  • 17. Introducing VC# FAQs • What are the basic system requirements for programming in VC#? Processor • 450 MHz Pentium II-class processor and above Operating System • Windows XP professional • Windows XP Home Edition • Windows 2000 Professional (SP3 or above) • Windows 2000 Server (SP3 or above) • Microsoft Windows Server 2003 Memory • 160 MB of RAM or above Hard Disk • 1.5 GB for installation • 2 GB for MSDN Library documentation • 500 MB of space while working ©NIIT Introduction to VB .NET Slide 17 of 41
  • 18. Introducing VC# FAQs (Contd.) Display • Super VGA or above Others • NET framework software development kit • Editor to write source code • How do I get the .NET runtime? • You can get the .NET runtime on the Microsoft MSDN site: http://msdn.microsoft.com/netframework/technologyinfo/howtoget/d efault.aspx • You can also now get the framework via the Windows Update function of the Start menu. .NET also comes with Windows Server 2003, and Office 2003. ©NIIT Introduction to VB .NET Slide 18 of 41
  • 19. Introducing VC# FAQs (Contd.) • Can null be assigned to local variables? The Just-In-Time (JIT) compiler converts the intermediate code to native code so that it can execute on the target operating system. JIT keeps a track of lifetime of variables and analyzes when there is no need of that variable. Assigning null increases the lifetime of a variable. ©NIIT Introduction to VB .NET Slide 19 of 41
  • 20. Introducing VC# Challenge ©NIIT Introduction to VB .NET Slide 20 of 41
  • 21. Introducing VC# Challenge (Contd.) • Across: • (Across 5) A model through which security is achieved in .NET platform.<Abbv.> (3) • (Across 61) Descriptive data stored in PE along with MSIL. (3) • (Across 92) A compiler that compiles the portable executable.<Abbv.> (3) • (Across 103) A single deployable unit that contains all the information about the implementation of classes, structures, and interfaces. (8) • Down: • (Down 2) A directive used to reference classes in the namespace.<Abbv.> (5) • (Down 7) An architecture in which a single executable file handles all functions relating to the user, business, and data service layers. (10) • (Down 8) Help to create logical groups of related classes and interfaces. (10) • (Down 30) Feature that allows you to place a window against any of the edges of the parent window. (7) • (Down 84) The system that specifies the type supported by CLR.<Abbv.> (3) ©NIIT Introduction to VB .NET Slide 21 of 41
  • 22. Introducing VC# Solutions to Challenge ©NIIT Introduction to VB .NET Slide 22 of 41
  • 23. Introducing VC# Variables and Statements in VC# • The object class is the base class of all data types. Data types represent the characteristics, such as size and range, of the data in memory. • VC# supports two categories of data types: • Value Types • Reference Types ©NIIT Introduction to VB .NET Slide 23 of 41
  • 24. Introducing VC# Programming with Variables and Statements in VC#(Contd.) • Value Types are further categorized into two types: • Bool type • The bool type represents 16-bit boolean logical values, such as true and false. The default value of the bool type is false. • Numeric Types • Numeric data types are further categorized into two types: • Integral • Floating point • Decimal ©NIIT Introduction to VB .NET Slide 24 of 41
  • 25. Introducing VC# Programming with Variables and Statements in VC#(Contd.) • Reference Data Types • The reference data types contain a reference of a variable of the data type, such as a class or a string. • A class type consists of data members, such as fields and constants. In addition, a class type consists of function members, such as methods, properties, and operators. • The string type inherits directly from the object class. You can use the variables of the string type to store strings. ©NIIT Introduction to VB .NET Slide 25 of 41
  • 26. Introducing VC# Programming with Variables and Statements in VC#(Contd.) • Variables • VC# categorizes variables into three types based on their scope and availability. The three types of variables are: • Static variables • Instance variables ©NIIT Introduction to VB .NET Slide 26 of 41
  • 27. Introducing VC# Programming with Variables and Statements in VC#(Contd.) • Statements • You can use statements to perform conditional execution in a program. C# provides the following statements: • if statement • Executes a block of code based on the value of a boolean expression. • The goto statement • Transfers the control to a statement that is identified by a label. ©NIIT Introduction to VB .NET Slide 27 of 41
  • 28. Introducing VC# Programming with Variables and Statements in VC#(Contd.) • The switch statement • Executes the block of code that is associated with the value of the controlling expression. • The for statement • It consists of an initialization expression, a condition, and an increment statement. The for statement evaluates the initialization expression. The statement repeatedly executes the code within the for block until the condition is false. • The for..each statement • It checks a condition for each element in an array. ©NIIT Introduction to VB .NET Slide 28 of 41
  • 29. Introducing VC# Programming with Variables and Statements in VC#(Contd.) • The while statement • It conditionally executes the code within the while block zero or more times. • the do..while statement • It conditionally executes the code within the do..while block one or more times ©NIIT Introduction to VB .NET Slide 29 of 41
  • 30. Introducing VC# From the Expert’s Desk • This section provides: • Best Practices • Tips and Tricks • FAQs ©NIIT Introduction to VB .NET Slide 30 of 41
  • 31. Introducing VC# Best Practices Recommended Function Scope • Whenever a new application is developed, all the methods defined inside the solution projects should be declared with the private access-modifier. This helps in developing a robust application. When private access-modifier is used in a method declaration, no object of the containing class or the classes derived from the containing class will be able to access the private method. Whenever there is a need to use a private method in derived classes for overriding, the private modifier can be replaced by protected modifier. If there is a need to call the private methods through objects of other classes, the private or protected modifier can be replaced by public modifier. ©NIIT Introduction to VB .NET Slide 31 of 41
  • 32. Introducing VC# Best Practices(Contd.) Use Inheritance For Extensibility And Maintainability • You should try to create new forms and controls by inheriting through the existing forms and controls of the project. This helps in debugging the applications. Consider the example of form inheritance. It is better to create a base form that has items such as logos, command buttons, menus etc. The new forms can now inherit from this form. It will help in developing applications quickly. In addition, it will increase the maintainability of the applications because the amount of code the programmer needs to write will be reduced. You should also write small codes in the functions and procedures. ©NIIT Introduction to VB .NET Slide 32 of 41
  • 33. Introducing VC# Tips and Tricks Tips on Shortcut Menus in VC# • The Toolbox (Ctrl+Alt+X) window has multiple tabs. You can drag and drop code onto this window and copy it anywhere. Some tabs do not allow dropping code into them. To identify the tabs that allow dropping code into them can be identified through a unique icon. The General tab has the icon. • Ctrl+- (Ctrl + Hyphen) is used to navigate through the code positions you visited recently. Ctrl+Shift+- is used to navigate in the opposite direction. Floating point • Matching brace / comment / region / quote works in VC# only. Ctrl+] is used to find a matching brace. It can also be used to find a matching comment, region or quote depending upon what is pointed by the cursor currently. ©NIIT Introduction to VB .NET Slide 33 of 41
  • 34. Introducing VC# Tips and Tricks (Contd.) Tips on Shortcut Menus in VC# • Press Alt and then select the area you want to copy with your mouse. • Build and Debug shortcut keys: • Build - Ctrl+Shift+B • Run - Ctrl+F5 • Debug – F5 • Navigate through build errors - F8 ©NIIT Introduction to VB .NET Slide 34 of 41
  • 35. Introducing VC# FAQs • Can static and instance methods be declared with the same name? Yes, static and instance methods be declared with the same name. Whenever the method will be invoked through the containing class, the static version of the method will be executed. In contrast, whenever the method will be invoked through an object of the class containing the methods, the instance version of the method will be executed • State the difference between override and new modifiers? Override modifier enables a base class method to hide the derived class implementation of the method. In contrast, the new modifier enables a derived class method to hide the base class implementation of the method. ©NIIT Introduction to VB .NET Slide 35 of 41
  • 36. Introducing VC# FAQs (Contd.) • What is the difference between managed code and unmanaged code? Managed code is the code that is managed by the CLR. In other words, managed code is written to target the CLR. All code written in Visual Basic and C# is managed by default. Unmanaged code, on the other hand, does not benefit from the features provided by the CLR, such as garbage collection and type safety. • Is it possible to monitor the activities and performance of the CLR? Yes. You can use Perfmon.exe in Windows 2000 to monitor the activities and performance of the CLR. Expand the Performance Logs and Alerts node. Click on Counter Logs. Double-click System Overview. In the System Overview Properties dialog box, click the Add button. In the Select Counters dialog box, select the Performance object drop-down list. This list displays various objects, such as .NET CLR Interop and .NET CLR Memory. You can add these objects and monitor the activities and performance of the CLR. ©NIIT Introduction to VB .NET Slide 36 of 41
  • 37. Introducing VC# Challenge ©NIIT Introduction to VB .NET Slide 37 of 41
  • 38. Introducing VC# Challenge (Contd.) • Across: • (Across 2) Which formal parameter in VC# is declared without any modifier? (5) • (Across 22) Which access-modifier restrict the methods to be referenced inside the program only? (9) • (Across 42) Which modifier is used with parameter arrays in the formal parameter list of a method declaration? (6) • (Across 112) Which methods are called through class names? (6) • Down: • (Down 1) The method body of an external method simply consists of? (9) • (Down 2) Name the keyword used as return-type of a method that does not return anything. (4) ©NIIT Introduction to VB .NET Slide 38 of 41
  • 39. Introducing VC# Challenge (Contd.) • (Down 6) Name the method-modifier which enables language interoperability. (6) • (Down 8) Which modifier for a method prevents a derived class from further overriding a base class function in VC#? (6) • (Down 14) What do you call a user-defined declarative information attached to class member declarations? (9) • (Down 42) Which modifier cannot be used if virtual, override, or abstract modifiers are being used? (7) • (Down 43) Which modifier cannot be used if the virtual modifier is used for a method? (8) • (Down 45) What is the name given to the arguments passed in a method call? • (Down 67) Which access-modifier enables methods to be referenced outside the class through objects? (6) ©NIIT Introduction to VB .NET Slide 39 of 41
  • 40. Introducing VC# Solution to Challenge ©NIIT Introduction to VB .NET Slide 40 of 41
  • 41. Introducing VC# Summary • VC# is an object-oriented language that enables you to build applications for the Microsoft .NET platform. • You can create applications in VC#, which can be used as independent components for the .NET platform • VC#, as a part of the Microsoft Visual Studio .NET, has been developed as an extension of C++ to provide flexibility and control to a programmer. However, VC# shares the same semantics as C++ for creating applications. • There are some syntactical differences between VB.NET and VC# codes • The object class is the base class of all data types. Data types represent the characteristics, such as size and range, of the data in memory. • VC# supports two categories of data types: • Value Types • Reference Types ©NIIT Introduction to VB .NET Slide 41 of 41