Download presentation
Presentation is loading. Please wait.
Published bySilvester Baker Modified over 7 years ago
1
Subject Name: C# PROGRAMMING AND .NET CONCEPTS Subject Code: 10CS761
Prepared By: Suganthi Sivakumar Department: CSE Date 5/28/2018
2
C# PROGRAMMING AND .NET CONCEPTS
UNIT-I Engineered for Tomorrow C# PROGRAMMING AND .NET CONCEPTS - UNIT I
3
C# PROGRAMMING AND .NET CONCEPTS - UNIT I
THE PHILOSOPHY OF .NET Engineered for Tomorrow C# PROGRAMMING AND .NET CONCEPTS - UNIT I
4
Learning Outcomes The idea of Building blocks of .NET, .NET base class libraries, CTS, CLR, CLS, CIL& Metadata, Assembly Manifest, Namespaces will be obtained. 5/28/2018
5
Topic details Introduction Previous State of Affairs
Building blocks of .NET .NET base class libraries CTS CLR CLS CIL& Metadata Assembly Manifest Namespaces 5/28/2018
6
C# PROGRAMMING AND .NET CONCEPTS - UNIT I
1.1INTRODUCTION Engineered for Tomorrow 1.1.1 Defining the .NET Framework: The .NET Framework is A software development environment A runtime engine for Managed Code A platform designed for Internet-Distributed software The .NET Framework is an exciting new computing platform A new computing platform designed to simplify application development A consistent object-oriented programming environment A code-execution environment that: Minimizes software deployment and versioning conflicts Eliminates the performance problems of scripted or interpreted environments C# PROGRAMMING AND .NET CONCEPTS - UNIT I
7
C# PROGRAMMING AND .NET CONCEPTS - UNIT I
Engineered for Tomorrow 1.1.2 Components of .NET .NET Framework Class Libraries Common Language Runtime (CLR) NET Framework Class Libraries Provide functionality for ASP.NET, XML Web Services, ADO.NET, Windows Forms, basic system functionality Reusable types that tightly integrate with the CLR Sit on top of the CLR C# PROGRAMMING AND .NET CONCEPTS - UNIT I
8
C# PROGRAMMING AND .NET CONCEPTS - UNIT I
Engineered for Tomorrow 1.1.4 Common Language Runtime(CLR) Code that targets the CLR is referred to as managed code All managed code has the features of the CLR Object Oriented, Cross-language integration, Cross language exception handling, Multiple version support Objects whose lifetimes are managed by the CLR are referred to as Managed Data Automatic memory management reduces memory leaks All CLR-compliant compilers use a common type system Allows for cross-language inheritance Passing object instances across language barriers Invoking methods across language barriers C# PROGRAMMING AND .NET CONCEPTS - UNIT I
9
C# PROGRAMMING AND .NET CONCEPTS - UNIT I
Engineered for Tomorrow 1.1.5 Intermediate Language CPU independent machine language Just-in-time compiled at runtime 1.1.6 Metadata Structured information Describes programming constructs including Classes definitions, field and method definitions, parameter lists, return types, etc 1.1.7 Just-In-Time compiler The CLR JIT-compiles the IL and metadata At execution time Executed directly by CPU C# PROGRAMMING AND .NET CONCEPTS - UNIT I
10
1.2 PREVIOUS STATE OF AFFAIRS
Engineered for Tomorrow Life As a C/Win32 API Programmer Life As a C++/MFC Programmer Life As a Visual Basic 6.0 Programmer Life As a Java/J2EE Programmer Life As a COM Developer Life As a Windows DNA Programmer C# PROGRAMMING AND .NET CONCEPTS - UNIT I
11
C# PROGRAMMING AND .NET CONCEPTS - UNIT I
Engineered for Tomorrow 1.2.1 Life As a C/Win32 API Programmer Terse language It is complex Not an Object Oriented Language Manual memory management 1.2.2 Life As a C++/MFC Programmer C++ with MFC is still complex and error prone Root is C 1.2.3 Life As a Visual Basic 6.0 Programmer Doesn’t support inheritance No Multithreading Low level API calls are complex C# PROGRAMMING AND .NET CONCEPTS - UNIT I
12
C# PROGRAMMING AND .NET CONCEPTS - UNIT I
Engineered for Tomorrow 1.2.4 Life As a Java/J2EE Programmer Not suitable for graphic intensive problems No cross Language Integration support 1.2.5 Life As a COM Developer Complex creation of COM Types Location Transparent nature can be accessed in language independent manner Reusable binary code 1.2.6 Life As a Windows DNA Programmer It is complex Requires use of numerous technologies and languages C# PROGRAMMING AND .NET CONCEPTS - UNIT I
13
C# PROGRAMMING AND .NET CONCEPTS - UNIT I
Engineered for Tomorrow 1.3 THE .NET SOLUTION 1.3.1 Features provided by .NET Full interoperability with existing code Complete and total language integration Common runtime engine shared by all .NET aware languages Base class library No more COM Plumbing Truly simplified deployment model C# PROGRAMMING AND .NET CONCEPTS - UNIT I
14
1.4 Building Blocks of .NET Platform
Engineered for Tomorrow 1.4 Building Blocks of .NET Platform VB C++ C# J# Python … Visual Studio.NET Common Language Specification Web Services User Interface ASP.NET Data and XML Base Class Library Common Language Runtime (CLR) Operating System C# PROGRAMMING AND .NET CONCEPTS - UNIT I
15
C# PROGRAMMING AND .NET CONCEPTS - UNIT I
Engineered for Tomorrow 1.4.1 CLR(Common Language Runtime) Code management at program execution Provides memory management, thread management, security management, code verification, compilation services Supports cross language integration, cross language exception handling, deployment support, debugging 1.4.2 CTS(Common Type System) Defines how types are declared, used and managed in the runtime 1.4.3 CLS(Common Language Specification) A set of rules that defines a subset of types and specifications C# PROGRAMMING AND .NET CONCEPTS - UNIT I
16
1.5 THE ROLE OF BASE CLASS LIBRARIES
Engineered for Tomorrow 1.5 THE ROLE OF BASE CLASS LIBRARIES The Base Class Library Data Access Windows Forms Security XML/SOAP Threading File I/O Web Forms (et al.) The Common Language Runtime Common Type System Common Language Specification C# PROGRAMMING AND .NET CONCEPTS - UNIT I
17
1.6 WHAT C# BRINGS TO THE TABLE
Engineered for Tomorrow 1.6 WHAT C# BRINGS TO THE TABLE No pointers required Automatic memory management through garbage collection Supports operator overloading Ability to build generic types and generic members Supports enumerations, structures Supports interface based programming languages C# PROGRAMMING AND .NET CONCEPTS - UNIT I
18
1.7Overview of .NET Assemblies
Engineered for Tomorrow 1.7Overview of .NET Assemblies After compilation of program in .NET, the resulting file is called Assembly Assembly contains additional information that .NET framework will use It contains manifest 1.7.1 Manifest Set of metadata Contains information about assembly itself It contains name, version, list of files of an assembly C# PROGRAMMING AND .NET CONCEPTS - UNIT I
19
C# PROGRAMMING AND .NET CONCEPTS - UNIT I
Engineered for Tomorrow 1.7.2 Role of CIL CIL sits above a specific compiler The associated compiler emits CIL instructions and stored in assembly Assembly is stores in PE format(.dll or .exe) 1.7.3 Role of .NET Type Metadata CLR generates metadata during compilation & stores in assembly Allows to write component in c# C# PROGRAMMING AND .NET CONCEPTS - UNIT I
20
1.8 The Role of Assembly Manifest
Engineered for Tomorrow 1.8 The Role of Assembly Manifest 1.8.1 Single file assemblies Contains CIL, Metadata & Manifest in a single well defined package 1.8.2 Multifile Assemblies Composed of modules One of the module must contain Assembly manifest C# PROGRAMMING AND .NET CONCEPTS - UNIT I
21
1.9 Compiling CIL to Platform specific instructions
Engineered for Tomorrow 1.9 Compiling CIL to Platform specific instructions 1.9.1 Just-In-Time Compiler Compiles CIL instructions into corresponding machine code Also called as jitter C# PROGRAMMING AND .NET CONCEPTS - UNIT I
22
C# PROGRAMMING AND .NET CONCEPTS - UNIT I
Engineered for Tomorrow 1.9.2 From Source Code to Managed .exe using System.Windows.Forms; using System.Drawing; class MyForm:Form{ public static void Main(){ Application.Run( new MyForm()); } protected override void OnPaint( PaintEventArgs e){ e.Graphics.DrawString( "Hello World!", new Font("Arial",35), Brushes.Blue, 10, 100); SomeSource.cs C# Compiler SomeSources.exe IL Metadata A Managed Application C# PROGRAMMING AND .NET CONCEPTS - UNIT I
23
1.9.3 Executing a Managed Application
Engineered for Tomorrow 1.9.3 Executing a Managed Application At execution time the IL and Metadata are JIT compiled SomeSources.exe IL Metadata Running Process’ Memory JIT Compiler Native Machine Language The CPU executes the JIT- compiled machine code directly C# PROGRAMMING AND .NET CONCEPTS - UNIT I
24
Before installation or the first time each method is called
Engineered for Tomorrow 1.9.4 Compilation And Execution Assembly Code (IL) Language Compiler Source Code Metadata Execution JIT Compiler Native Code Compilation Before installation or the first time each method is called C# PROGRAMMING AND .NET CONCEPTS - UNIT I
25
1.10 Understanding the common type system
Engineered for Tomorrow 1.10 Understanding the common type system Specifies how type definitions and specific values of types are presented in memory Allow programs written in different languages to share information easily Defines rules that languages must follow Provides object oriented model Establishes a framework to enable cross language integration, type safety CTS Structure Types Derived from a common base class System.TypeValue C# PROGRAMMING AND .NET CONCEPTS - UNIT I
26
C# PROGRAMMING AND .NET CONCEPTS - UNIT I
Engineered for Tomorrow CTS class types Contains methods, properties, events etc Multiple inheritance is allowed CTS Enumeration Type To group name/value pairs under a specific name CTS Interface Type Same As Pure Abstract class in C++ Similar to class, but never instantiated CTS Delegate Type Same as C’s Function pointer C# PROGRAMMING AND .NET CONCEPTS - UNIT I
27
1.11 Intrinsic CTS Data Types
Engineered for Tomorrow 1.11 Intrinsic CTS Data Types CTS Data Type C# Keyword System.Byte byte System.Int16 short System.Int32 int System.Int64 long System.Single float System.UInt16 ushort System.UInt32 uint C# PROGRAMMING AND .NET CONCEPTS - UNIT I
28
1.12 Understanding Common Language Specification
Engineered for Tomorrow 1.12 Understanding Common Language Specification Set of guidelines that describe the minimal and complete set of features a given .NET aware compiler must support C# allows operator overloading VB .NET does not The void functions may differ in syntax: VB .NET C# public Sub Foo() public void Foo() …………………… {………………..} End Sub C# PROGRAMMING AND .NET CONCEPTS - UNIT I
29
C# PROGRAMMING AND .NET CONCEPTS - UNIT I
Engineered for Tomorrow CLS Compilance C# Type CLS Compilance byte Yes sbyte No short int long ulong float double object C# PROGRAMMING AND .NET CONCEPTS - UNIT I
30
1.13 Common Language Runtime(CLR)
Engineered for Tomorrow 1.13 Common Language Runtime(CLR) .NET Compiler .NET Source Code DLL or EXE(CIL) mscoree.dll .NET Execution Engine Class Loader Base Class Libraries (mscorlib.dll) Jitter Platform specific code Execute C# PROGRAMMING AND .NET CONCEPTS - UNIT I
31
C# PROGRAMMING AND .NET CONCEPTS - UNIT I
Engineered for Tomorrow 1.14 .NET Namespaces System is the root namespace Example using System; public class MyApp { public static void Main() Console.WriteLine(“Welcome to C#”); } C# PROGRAMMING AND .NET CONCEPTS - UNIT I
32
C# PROGRAMMING AND .NET CONCEPTS - UNIT I
Engineered for Tomorrow Sample .NET namespaces System Primitive types, garbage collection etc System.Collections Container objects: ArrayList, Stack, Queue etc System.io File I/O, buffering etc System. Threading Threads System.Data System.Data.Comm System.Data.OleDb System.Data.SqlClient For database manipulations ADO .NET System.Drawing System.Drawing.2D GDI+ primitives, bitmaps, fonts, icons, etc C# PROGRAMMING AND .NET CONCEPTS - UNIT I
33
C# PROGRAMMING AND .NET CONCEPTS - UNIT I
Summary The Building blocks of .NET, .NET base class libraries, CTS, CLR, CLS, CIL& Metadata, Assembly Manifest, Namespaces are discussed. C# PROGRAMMING AND .NET CONCEPTS - UNIT I
34
C# PROGRAMMING AND .NET CONCEPTS - UNIT I
Engineered for Tomorrow Question Bank 1)Explain the CLR. Illustrate the workflow that takes place between the source code, given .NET compiler and the .NET execution engine. 2)Explain the complexities found in the technologies prior to .NET. Briefly describe. Explain how .NET attempts to simply the same 3)Justify “ How The .NET Framework is a Radical and Brute- Force’ 4)List and explain the intrinsic CTS data types and .NET namespaces in C#. 5) a)Briefly explain how the history of .NET. 6)Explain the building components of .NET and their responsibilities. C# PROGRAMMING AND .NET CONCEPTS - UNIT I
35
C# PROGRAMMING AND .NET CONCEPTS - UNIT I
Engineered for Tomorrow Question Bank 7)Explain Jitter. Along with its benefits. 8)Explain how CLR host an application on .NET platforms. Give the block diagram. 9)What is an assembly? Explain each component of an assembly. 10)Differentiate between single file and multi file assembly. 11)What is .NET assembly? What does it contain? Explain each of them. 12) Write a note on .NET namespaces. C# PROGRAMMING AND .NET CONCEPTS - UNIT I
36
C# PROGRAMMING AND .NET CONCEPTS - UNIT I
Engineered for Tomorrow THANK YOU C# PROGRAMMING AND .NET CONCEPTS - UNIT I
37
C# PROGRAMMING AND .NET CONCEPTS
UNIT-II Engineered for Tomorrow C# PROGRAMMING AND .NET CONCEPTS - UNIT II
38
Building C# Applications
Engineered for Tomorrow C# PROGRAMMING AND .NET CONCEPTS - UNIT II
39
Learning Outcomes The idea of command line compiler, response files, code debugger, bug reports generation, pre processor directives, system Environment class will be obtained 5/28/2018
40
C# PROGRAMMING AND .NET CONCEPTS - UNIT II
Topic details Engineered for Tomorrow csc.exe csc.rsp cordbg.exe Remaining c# compiler options Visual studio .NET IDE Other key aspects Documenting source code via XML C# preprocessor Directives System Environment class C# PROGRAMMING AND .NET CONCEPTS - UNIT II
41
2.1 The role of the command Line compiler (csc.exe)
Engineered for Tomorrow To create and run programs using the C# command-line compiler: Enter the program using a text editor Compile the program Run the program C# PROGRAMMING AND .NET CONCEPTS - UNIT II
42
C# PROGRAMMING AND .NET CONCEPTS - UNIT II
Example Engineered for Tomorrow using System; class MainClass { public static void Main() { Console.WriteLine("A simple C# program."); } } To Compile: csc MainClass.cs C# PROGRAMMING AND .NET CONCEPTS - UNIT II
43
C# PROGRAMMING AND .NET CONCEPTS - UNIT II
Engineered for Tomorrow 2.1.1 Rules for Command line Syntax for the c# compiler Arguments are delimited by white space, which is either a space or a tab The caret character (^) is not recognized as an escape character or delimiter. The character is handled by the command-line parser in the operating system before it is passed to the argv array in the program A string enclosed in double quotation marks ("string") is interpreted as a single argument, regardless of white space that is contained within. A quoted string can be embedded in an argument A double quotation mark preceded by a backslash (\") is interpreted as a literal double quotation mark character (") C# PROGRAMMING AND .NET CONCEPTS - UNIT II
44
C# PROGRAMMING AND .NET CONCEPTS - UNIT II
Engineered for Tomorrow Backslashes are interpreted literally, unless they immediately precede a double quotation mark If an even number of backslashes is followed by a double quotation mark, one backslash is put in the argv array for every pair of backslashes, and the double quotation mark is interpreted as a string delimiter If an odd number of backslashes is followed by a double quotation mark, one backslash is put in the argv array for every pair of backslashes, and the double quotation mark is "escaped" by the remaining backslash. This causes a literal double quotation mark (") to be added in argv C# PROGRAMMING AND .NET CONCEPTS - UNIT II
45
C# PROGRAMMING AND .NET CONCEPTS - UNIT II
Engineered for Tomorrow 2.2 Compiling the Program C:\>csc Example.cs Prior to running csc.exe, you may need to run the batch file vcvars32.bat, which is typically found in the //Program Files/Microsoft Visual Studio.NET/Vc7/Bin directory The name of a C# program is arbitrary By convention, C# programs use the .cs file extension Compiles File.cs producing File.exe: csc File.cs Compiles File.cs producing File.dll: csc /target:library File.cs C# PROGRAMMING AND .NET CONCEPTS - UNIT II
46
C# PROGRAMMING AND .NET CONCEPTS - UNIT II
Engineered for Tomorrow 2.2.1 Categories of Flags provided by csc.exe C# Compiler Category Definition Output Files Options that control the format of the generated assembly and strong name information Input Files Options that allow you to specify input files and referenced assemblies Resources used to embed any required resources, such as icons and string tables, into the assembly Code Generation control the generation of debug symbols Errors and Warnings Controls how the compiler handles source code errors/warnings C# PROGRAMMING AND .NET CONCEPTS - UNIT II
47
C# PROGRAMMING AND .NET CONCEPTS - UNIT II
Engineered for Tomorrow 2.2.2 Input-centric options of csc.exe Input Flags Definition /recurse Informs csc.exe to compile C# files located in a project's subdirectory structure. This flag supports wildcard syntax /reference (/r) Used to specify the external assemblies to reference in the current compilation /addmodule Used to specify the modules to include in a multifile assembly C# PROGRAMMING AND .NET CONCEPTS - UNIT II
48
2.2.3 Output-centric options of csc.exe
Engineered for Tomorrow 2.2.3 Output-centric options of csc.exe Output Flags Definition /out Specifies the name of the assembly to generate. If omitted, the name of the output file is based on the name of the initial input file or the class defining the Main() method /target (/t) Specifies the file format of the assembly to be created /doc Used to generate XML documentation files /delaysign Allows you to build an assembly using delayed signing of the strong name /keyfile Specifies the path to the *.snk file used to strongly name the assembly C# PROGRAMMING AND .NET CONCEPTS - UNIT II
49
2.2.4 Variations of the /target flag
Engineered for Tomorrow 2.2.4 Variations of the /target flag Target Decoration Definition /target:exe Creates a Console based assembly. This is the default if no /target option is specified /target:winexe Creates a Windows Forms based executable assembly. While you could create a Windows Forms application using /target:exe, a Console window will be looming in the background of your main Form /target:library Used to build a .NET code library (*.dll) /target:module Creates a module that will become part of a multifile assembly C# PROGRAMMING AND .NET CONCEPTS - UNIT II
50
2.3 Working with csc.exe Response files
Engineered for Tomorrow 2.3 Working with csc.exe Response files Contain all of the options you want to feed into csc.exe Used to build MyCodeLibrary.dll To specify multiple response files: Response files are processed in the order they are encountered C# PROGRAMMING AND .NET CONCEPTS - UNIT II
51
2.3.1 The Default Response File & the /noconfig Option
Engineered for Tomorrow 2.3.1 The Default Response File & the /noconfig Option Default response file is csc.rsp Automatically processed by csc.exe during each compilation To disable the inclusion of csc.rsp, you may specify the /noconfig flag: csc C# PROGRAMMING AND .NET CONCEPTS - UNIT II
52
2.4 GENERATING BUG REPORTS
Engineered for Tomorrow 2.4 GENERATING BUG REPORTS /bugreport Specifies that debug information should be placed in a file for later analysis /bugreport:file File The name of the file that you want to contain your bug report C# PROGRAMMING AND .NET CONCEPTS - UNIT II
53
Debug-centric option of csc.exe
Engineered for Tomorrow 2.4.1 Debug-centric options of csc.exe Debug-centric option of csc.exe Definition /debug Instructs csc.exe to emit a *.pdb file for use by debugging tools, such as cordbg.exe, dbgclr.exe, or Visual Studio /warnaserror Treats all warnings as a critical error /warn Allow you to specify the warning level for the current compilation (0, 1, 2, 3 or 4) /nowarn Allows you to disable specific C# compiler warnings C# PROGRAMMING AND .NET CONCEPTS - UNIT II
54
2.5 REMAINING C# COMPILER OPTIONS Remaining Options of csc.exe
Engineered for Tomorrow 2.5 REMAINING C# COMPILER OPTIONS Remaining Options of csc.exe Definition /baseaddress This option allows you to specify the desired base address to load a *.dll. By default, the base address is chosen by the CLR /checked Specifies if integer arithmetic that overflows the bounds of the data type will cause an exception at run time /codepage Specifies the code page to use for all source code files in the compilation /filealign This option controls the section sizing within the output assembly (512, 1024, 2048, 4096 or 8192 bytes) C# PROGRAMMING AND .NET CONCEPTS - UNIT II
55
Remaining Options of csc.exe
Engineered for Tomorrow Remaining Options of csc.exe Definition /langversion This option instructs the compiler to only use ISO-1 C# language features, which basically boils down to C# 1.0 language features /main If your current project defines multiple Main() methods, which can be helpful during unit testing, this flag allows you to specify which Main() method to execute when the assembly loads /nostdlib By default, assembly manifests automatically reference mscorlib.dll. Specifying this option disables this behavior C# PROGRAMMING AND .NET CONCEPTS - UNIT II
56
C# PROGRAMMING AND .NET CONCEPTS - UNIT II
Engineered for Tomorrow /optimize This option emits metadata that also instructs the CLR to optimize code at run time /platform This flag informs the compiler to optimize the assembly for 32- or 64-bit processors. By and large, this option is only useful if your C# code base is making use of P/Invoke and/or unsafe code constructs. The default value is 'anycpu' /unsafe When enabled, this option allows your C# files to declare an unsafe scope, which are typically used to manipulate C++ style pointers /utf8output This option informs the compiler to output data using UTF-8 encoding C# PROGRAMMING AND .NET CONCEPTS - UNIT II
57
2.6 The command Line Debugger (cordbg.exe)
Engineered for Tomorrow 2.6 The command Line Debugger (cordbg.exe) command-line runtime debugger Run-time debugger allows you to perform the following tasks: Start, attach to, continue, detach from, and stop a running process Display application domains, assemblies, loaded modules, classes, and global functions Step into and over both source and native instructions. Show source-code lines Set the value of a variable Set the next statement to a new line Set or display breakpoints C# PROGRAMMING AND .NET CONCEPTS - UNIT II
58
C# PROGRAMMING AND .NET CONCEPTS - UNIT II
Engineered for Tomorrow Full list of CorDbg options can be displayed by typing CorDbg /? Command Description a[ttach] pid Attaches the debugger to a running process b[reak] [[file:] line number] |[[ class::] function [:offset]] Sets or displays breakpoints ca[tch] [event] Displays a list of event types, or causes the specified event type to stop the debugger cont [count] Continues the program del[ete] [breakpoint id, ...] Deletes breakpoints ex[it] Stops the current process and exits the debugger h[elp] [command ...] Displays descriptions for the specified commands k[ill] Stops the current process newo[bj] class Creates a new object using the current thread C# PROGRAMMING AND .NET CONCEPTS - UNIT II
59
C# PROGRAMMING AND .NET CONCEPTS - UNIT II
Engineered for Tomorrow Command Description o[ut] [count] Steps the program out of the current function q[uit] exit r[un] [executable [args]] Kills the current process and starts a new one s[tep] [count] Steps the program to the next source line, stepping into function calls <filename Reads and executes commands from the specified filename setip line number Sets the next statement to execute to the specified line number reg[isters] Displays the contents of the registers for the current thread p[rint] [variable name] Displays one or more local variables along with their values news[tr] string Creates a new string using the current thread C# PROGRAMMING AND .NET CONCEPTS - UNIT II
60
2.7USING THE VISUAL STUDIO. NET IDE
Engineered for Tomorrow 2.7USING THE VISUAL STUDIO. NET IDE An integrated development environment (IDE), is a type of computer software that assists computer programmers to develop software The Visual Studio IDE consists of several sections, or tools The Toolbox on the left The Solution Explorer on the right The Code / Design view in the middle C# PROGRAMMING AND .NET CONCEPTS - UNIT II
61
C# PROGRAMMING AND .NET CONCEPTS - UNIT II
Engineered for Tomorrow Toolbox The Toolbox is a palette of developer objects, or controls, that are placed on forms or web pages, and then code is added to allow the user to interact with them Solution Explorer Used to view and modify the contents of the project Properties Windows Shows all the control properties to be change at design time Code / Design view This is where the magic takes place. Forms are designed graphically C# PROGRAMMING AND .NET CONCEPTS - UNIT II
62
C# PROGRAMMING AND .NET CONCEPTS - UNIT II
Engineered for Tomorrow Object Browser By pressing F2 or selecting it into the View menu, it's possible to explore all the available objects of the libraries (types, functions...). key features Single IDE for all .NET applications Cross Language integration Code editor supporting Intellisense and code refactoring Integrated debugger that works at source and machine level Customizable environment built-in Browser Compilation from within the environment based on defined configuration options Plug-in architecture C# PROGRAMMING AND .NET CONCEPTS - UNIT II
63
2.8 Other key aspects of the VS .NET IDE
Engineered for Tomorrow 2.8 Other key aspects of the VS .NET IDE Feature Description Annotations reporting Allows you to extract C# annotations and render them in HTML or store them in XML documents Auto-hide Allows you to stow minimized documents along the edges of the development environment and pops up docs as you mouse-over them Cascading Style Sheets Full support for creating styles that can be applied to HTML or XML elements Command window Allows you to invoke commands within the IDE C# PROGRAMMING AND .NET CONCEPTS - UNIT II
64
C# PROGRAMMING AND .NET CONCEPTS - UNIT II
Engineered for Tomorrow Feature Description Debugging support Enhanced debugging support for C#, C++, and Visual Basic directly in the environment, as well as support for managed-code and remote debugging Deployment tools Allows you to take advantage of Windows Installer to deploy applications; supports installation rollback and app advertising; graphical editor allows you to create installers; merge modules allow you to standardize component installation for multiple apps Document navigation Maintains such things as cursor history, allowing you to navigate back to parts of a document or to different windows C# PROGRAMMING AND .NET CONCEPTS - UNIT II
65
C# PROGRAMMING AND .NET CONCEPTS - UNIT II
Engineered for Tomorrow Feature Description Enhanced automation support Allows you to access and control parts of the IDE programmatically, such as the Code Editor, projects, tool windows, and debugging, building, and deployment tools HTML WYSIWYG design and source code editing of HTML documents Macro recording Allows you to record and play macros directly in the development environment Object browser Supports all languages and allows you to browse objects in projects, class libraries, and and so forth C# PROGRAMMING AND .NET CONCEPTS - UNIT II
66
C# PROGRAMMING AND .NET CONCEPTS - UNIT II
Engineered for Tomorrow Feature Description Editor features Too numerous to cover; includes auto-indent, color highlighting, auto-complete, clipboard rings, document navigation, and many more Schemas Supports the automatic creation of a schema from an XML document instance Start page Acts as a personal home page for your .Net development and provides access to news, updates, downloads, and documentation Web browser Allows you to display Web pages directly in the development environment XML Allows you to edit XML with syntax-directed highlighting C# PROGRAMMING AND .NET CONCEPTS - UNIT II
67
2.9 DOCUMENTING YOUR SOURCE CODE VIA XML
Engineered for Tomorrow 2.9 DOCUMENTING YOUR SOURCE CODE VIA XML In source code files, lines that begin with /// and that precede a user-defined type such as a class, delegate, or interface; a member such as a field, event, property, or method; or a namespace declaration can be processed as comments and placed in a file Example csc XMLsample.cs /doc:XMLsample.xml Example Tags /// <summary> /// This class performs an important function. /// </summary> C# PROGRAMMING AND .NET CONCEPTS - UNIT II
68
C# PROGRAMMING AND .NET CONCEPTS - UNIT II
Engineered for Tomorrow 2.9.1 Restrictions The documentation must be well-formed XML. If the XML is not well-formed, a warning is generated and the documentation file will contain a comment saying that an error was encountered Developers are free to create their own set of tags C# PROGRAMMING AND .NET CONCEPTS - UNIT II
69
C# PROGRAMMING AND .NET CONCEPTS - UNIT II
Engineered for Tomorrow 2.9.2 Example /// <summary> /// Class level summary documentation goes here. </summary> /// <remarks> /// onger comments can be associated with a type or member through /// the remarks tag.</remarks> public class TestClass : TestInterface { /// Store for the name property.</summary> private string _name = null; /// <summary> /// The class constructor. </summary> public TestClass() { // TODO: Add Constructor Logic here. } } C# PROGRAMMING AND .NET CONCEPTS - UNIT II
70
2.10 C# Preprocessor Directives Preprocessor Directive
Engineered for Tomorrow 2.10 C# Preprocessor Directives Preprocessor Directive Description. #define It defines a sequence of characters, called symbol #undef It allows you to undefine a symbol #if It allows testing a symbol or symbols to see if they evaluate to true #else It allows to create a compound conditional directive, along with #if #elif It allows creating a compound conditional directive #endif Specifies the end of a conditional directive C# PROGRAMMING AND .NET CONCEPTS - UNIT II
71
Preprocessor Directive
Engineered for Tomorrow Preprocessor Directive Description. #line It lets you modify the compiler's line number and (optionally) the file name output for errors and warnings #error It allows generating an error from a specific location in your code #warning It allows generating a level one warning from a specific location in your code #region It lets you specify a block of code that you can expand or collapse when using the outlining feature of the Visual Studio Code Editor #endregion It marks the end of a #region block C# PROGRAMMING AND .NET CONCEPTS - UNIT II
72
2.11 SYSTEM.ENVIRONMENT CLASS
Engineered for Tomorrow 2.11 SYSTEM.ENVIRONMENT CLASS The System.Environment class can be used to retrieve information like: command-line argument the exit code environment variable settings contents of the call stack time since last system boot the version of the common language runtime C# PROGRAMMING AND .NET CONCEPTS - UNIT II
73
C# PROGRAMMING AND .NET CONCEPTS - UNIT II
Engineered for Tomorrow PROPERTIES Name Description CommandLine Gets the command line for this process CurrentDirectory Gets or sets the fully qualified path of the current working directory CurrentManagedThreadId Gets a unique identifier for the current managed thread ExitCode Gets or sets the exit code of the process NewLine Gets the newline string defined for this environment C# PROGRAMMING AND .NET CONCEPTS - UNIT II
74
C# PROGRAMMING AND .NET CONCEPTS - UNIT I
Summary The command line compiler, response files, code debugger, bug reports generation, pre processor directives, system Environment class are discussed. C# PROGRAMMING AND .NET CONCEPTS - UNIT I
75
C# PROGRAMMING AND .NET CONCEPTS - UNIT I
Engineered for Tomorrow Question Bank 1)Write a C# program to display the following information using the System environment class: i) Current directory of application ii) Operating System Version iii) Host Name iv) .NET Version 2) Explain the building of a C# application using command line compiler CSE.exe 3) Explain how CSC.exe compiler is used to build is used to build C# applications. Explain any five flags with appropriate examples 4) Explain C# preprocessor directives: i) #region, #endregion ii) Conditional Code Compilation 5)Explain the following with respect to with respect to C# program in command Prompt i) Referencing external assemblies ii) Compiling Multiple Source files iii) Response Files iv) Generating bug Reports C# PROGRAMMING AND .NET CONCEPTS - UNIT I
76
C# PROGRAMMING AND .NET CONCEPTS - UNIT I
Engineered for Tomorrow Question Bank 6)Write a C# program to generate a Fibonacci series up to N. Value of N is read from Console 7) Explain command line debugger? 8) Write source code in C# to compute the square root of a number passed as a command line argument 9)What is CSC.rsp file? Where is it located? 10) How would you create object instance in C#? With examples 11) Describe default assignment of NET data types C# PROGRAMMING AND .NET CONCEPTS - UNIT I
77
C# PROGRAMMING AND .NET CONCEPTS - UNIT II
Engineered for Tomorrow THANK YOU C# PROGRAMMING AND .NET CONCEPTS - UNIT II
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.