Sie sind auf Seite 1von 32

What is Dot Net.

ppt

TDG - Injazat

NET FUNDAMENTALS

CONTENTS

NET Framework Core Components Common Language Runtime (CLR) Class Library Next Generation Windows Services (NGWS)

Changes Since 1.0 & 1.1 Changes Since 2.0 & 3.0 .Net 3.5 SP1 (Codename Arrowhead) .Net Framework Current Layer Cake The Most Important Feature Of .NET 4.0 .Net Framework 4.0

Assemblies Garbage Collection Names You Need To Know About What Really Happens Namespaces Tools Provided By The .NET Framework The Common Type System Controlling Access To A Method Or Field Using Value Types

Built-in Value Types

NET FRAMEWORK CORE COMPONENTS


The .NET framework has two major components: Common Language Runtime (CLR) Class Library
1. Net framework works like the Domino Objects only much lower level and very complete 2. It is part of the OS (or can be added) 3. Replaces win32 API calls - mostly 4. Decoupled from OS 5. Supports many programming languages with the CLR (Common Language Runtime)

TERMINOLOGY "ABC"

CLR: Common Language Runtime

One runtime for many programming languages One intermediate, high-level assembly-style language that is emitted by language compilers Container for code, metadata and resources your new term for what you used to call "D-L-L" Information that describes the shape of data and the runtime behavior of a program

Intermediate Language (IL)

Assembly

Metadata

COMMON LANGUAGE RUNTIME (CLR)

The CLR is the foundation upon which the .NET Framework has been built. The runtime manages code at execution time and provides all the core services such as memory management, thread management and remoting. It also enforces strict type safety and ensures code accuracy in order to provide security and robustness to the applications. This capability to manage code at runtime is the distinguishing feature of the CLR. All code that is managed by the CLR is known as managed code while other codes are known as unmanaged code. CLR Features 1. CLR manages memory, thread execution, code execution, compilation code safety verification and other system services. 2. For security reasons, managed code is assigned varying degrees of trust based on origin. This prevents or allows the managed component from performing file access operations, registry access operations or other sensitive functions even within the same active application. 3. The Runtime enforces code robustness by implementing strict type and code verification infrastructure called Common type System (CTS). The CTS ensures that all managed code is self describing and all Microsoft or third party language compiler generated codes conform to CTS. This enables the managed code to consume other managed types and enforce strict type fidelity and type safety. 4. CLR eliminates many common software issues like handling of object layout, references to objects and garbage clearance. This type of memory management prevents memory leaks and invalid memory references. 5. The CLR also accelerates developer productivity. The programmer is free to choose the language of the application without worrying about compatibility and integration issues. He is also enabled to take advantage of the runtime and the class library of the .NET Framework and also harvest components from other applications written in different languages by different developers. This implicitly eases the process of migration. 6. Though CLR aims to be futuristic software, it lends support to existing applications. The interoperability between the managed and unmanaged codes makes this process extremely simple. 7. The design of the CLR is geared towards enhancing performance. The Just-in-time (JIT) compiling enables managed code to run in the native machine language of the system executing it. During the process the memory manager removes the possibilities of fragmented memory and increases memory locality-of-reference to enhance performance. 8. Finally, server side applications can host runtime. High performance servers like Microsoft SQL Server and Internet Information Services can host this CLR and the infrastructure so provided can be used to write business logic while enjoying the best benefits of enterprise server support.

CLASS LIBRARY

The Class Library is an object oriented collection of reusable types. It is comprehensive and the types can be used to develop command line applications or GUI applications such as Web forms or XML Web services. Unmanaged components that load CLR into their processes can be hosted by the .NET Framework to initiate the execution of managed code. This creates a software environment that exploits both the managed and unmanaged codes. The.NET Framework also provides a number of runtime hosts and supports third party runtime hosts

Class Library Features 1. The class library is a collection of reusable types that integrate with the CLR. 2. It is object oriented and provides types from which user defined types can derive functionality. This makes for ease of use and is time saving. 3. Third party components can be integrated seamlessly with classes in the .NET framework. 4. It enables a range of common programming tasks such as string management, data collection and file access. 5. It supports a variety of specialized development scenarios such as console application development, Windows GUI applications, ASP.NET Applications, XML Web services.

NEXT GENERATION WINDOWS SERVICES (NGWS)


Microsoft started development on the .NET Framework in the late 1990s originally under the above name. By late 2000 the first beta versions of .NET 1.0 were released.

Version 1.0 1.1 2.0 3.0 3.5 4.0

Version Number 1.0.3705.0

Release Date 05-01-2002 Net 1.0

1.1.4322.573 01-04-2003 2.0.50727.42 07-11-2005 3.0.4506.30 3.5.21022.8 Beta 06-11-2006 19-11-2007 ???

CHANGES SINCE 1.0 & 1.1


Changes since 1.0 Built-in support for mobile ASP.NET controls. Previously available as an add-on for .NET Framework, now part of the framework. Security changes enable Windows Forms assemblies to execute in a semi-trusted manner from the Internet, and enable Code Access Security in ASP.NET applications. Built-in support for ODBC and Oracle databases. Previously available as an add-on for .NET Framework 1.0, now part of the framework. .NET Compact Framework a version of the .NET Framework for small devices. Internet Protocol version 6 (IPv6) support. Numerous API changes. Changes since 1.1 Numerous API changes. A new hosting API for native applications wishing to host an instance of the .NET runtime. The new API gives a fine grain control on the behavior of the runtime with regards to multithreading, memory allocation, assembly loading and more (detailed reference). It was initially developed to efficiently host the runtime in Microsoft SQL Server, which implements its own scheduler and memory manager. Full 64-bit support for both the x64 and the IA64 hardware platforms. Language support for generics built directly into the .NET CLR. Many additional and improved ASP.NET web controls. New data controls with declarative data binding. New personalization features for ASP.NET, such as support for themes, skins and webparts. .NET Micro Framework a version of the .NET Framework related to the Smart Personal Objects Technology initiative.

CHANGES SINCE 2.0 & 3.0


Changes since 2.0 .NET Framework 3.0 consists of four major new components: Windows Presentation Foundation (WPF), formerly code-named Avalon; a new user interface subsystem and API based on XML and vector graphics, which uses 3D computer graphics hardware and Direct3D technologies. See WPF SDK for developer articles and documentation on WPF. Windows Communication Foundation (WCF), formerly code-named Indigo; a service-oriented messaging system which allows programs to interoperate locally or remotely similar to web services. Windows Workflow Foundation (WF) allows for building of task automation and integrated transactions using workflows. Windows CardSpace, formerly code-named InfoCard; a software component which securely stores a persons digital identities and provides a unified interface for choosing the identity for a particular transaction, such as logging in to a website. Changes since version 3.0 New language features in C# 3.0 and VB.NET 9.0 compiler Adds support for expression trees and lambda methods Extension methods Expression trees to represent high-level source code at runtime. Anonymous types with static type inference Language Integrated Query (LINQ) along with its various providers LINQ to Objects LINQ to XML LINQ to SQL Paging support for ADO.NET ADO.NET synchronization API to synchronize local caches and server side datastores Asynchronous network I/O API Peer-to-peer networking stack, including a managed PNRP resolver Managed wrappers for WMI and Active Directory APIs Enhanced WCF and WF runtimes, which let WCF work with POX and JSON data, and also expose WF workflows as WCF services. WCF services can be made stateful using the WF persistence model. Support for HTTP pipelining and syndication feeds. ASP.NET AJAX is included

.NET 3.5 SP1 (CODENAME ARROWHEAD)

will reportedly enhance support for occasionally connected applications, and provide built-in support for the Microsoft ASP.NET Model-View-Controller (MVC) Framework. Arrowhead will increase the cold-start performance (startup when no other .NET Framework application has been started previously) of .NET Framework applications, by as much as 25 40%. It will also hardware accelerate some WPF effects such as shadows, as well as general performance and API enhancements across the WPF stack. In addition, a set of WPF controls, including a DataGrid will also be included. ADO.NET Entity Framework has also been added which gives the database based application programmer a ORM (Object Relational Mapping) tool.

.NET FRAMEWORK CURRENT LAYER CAKE

THE MOST IMPORTANT FEATURE OF .NET 4.0

.NET 4.0 is going to include some core changes, particularly in the area of parallel processing that is going to be very important to some people, and will eventually make it into all of our consciousness. .NET 4.0 will also include another chance for Entity Framework, .NET 4.0 will bring Azure and cloud computing to the forefront. .NET 4.0 is likely to offer patterns that will be the most important change in my coding since the huge changes brought on by LINQ (and supporting techniques like extensions and lambdas) of .NET 3.5. The most important feature of .NET 4.0 is Windows Workflow 4.0. (Windows Workflow 4.0 is a complete rewrite of workflow. It's a brand new product. More than just rewriting, it represents a rethinking of the problem.) And real business value is what its all about

.NET FRAMEWORK 4.0

COM SUPPORT: A PERSONAL VIEW

ASSEMBLIES
As in the Windows DNA world where DLLs and EXEs are the building blocks of applications, in the .NET world, it is the assembly that is the used as the foundation of applications.

GARBAGE COLLECTION

The .NET Framework is a garbage-collected environment. Garbage collection is the process of detecting when objects are no longer in use and automatically destroying those objects, thus freeing memory.

NAMES YOU NEED TO KNOW ABOUT

The Common Language Infrastructure (CLI) A subset of the .NET framework is the CLI. The CLI includes the functionality of the Common Language Runtime and specifications for the Common Type System, metadata and Intermediate language. A subset of the Framework Class Library incorporates the base class library, a Network library, a Reflection library, an XML library and Floating point and Extended Array Library. The shared source implementation of the CLI is available for both the FreeBSD and Windows operating Systems. The Common Language Specification (CLS) The CLR supports the CLS which is a subset of it. Additionally the CLR supports a set of rules that language and compiler designers follow. It provides robust interoperability between the .NET languages and the ability to inherit classes written in one language in any other .NET language. Cross language debugging also becomes a possibility in this scenario. It must be noted that the CLS rules apply only to publicly exposed features of a class. Classes A blueprint of an object is called a class. All definitions of haw a particular object will be instantiated at runtime, its properties and methods and storage structures are defined in the class. Classes are used by developers for creating instances of the class at runtime using the keyword New. Namespaces This is the key part of the .NET Framework. It provides scope for both preinstalled framework classes and custom developed classes. Vb.NET uses the Imports keyword to enable the use of member names from the namespace declared. C# uses the using keyword. In bot h cases the System Namespace is also imported so that the Console window can be written without explicitly referring to the System.Console.

Assemblies Assemblies are also known as managed DLLs. They are the fundamental unit of deployment for the .NET platform. The .NET framework itself is made of a number of assemblies. An assembly contains the Intermediate language generated by the language compiler, an assembly manifest, type metadata and resources. They can be private or public. They are self describing and hence different versions of the same assembly can be run simultaneously.
Intermediate language (IL) This is a processor independent representation of executable code. It is similar to assembly code and specific to the CLR. It is generated by the language compilers that target the CLR. At runtime, the CLR just-in-time compiles the IL to native code for execution. The tool ngen.exe which is part of the .NET framework pre-compiles assemblies to native code at install time and caches the precompiled code to the disk.

NAMES YOU NEED TO KNOW ABOUT

Managed execution This refers to code whose execution is managed by the CLR. It includes memory management, access security, cross-language integration for debugging and exception handling etc. These assemblies are required for the creation of metadata on the code and the assemblies so that the CLR can manage the execution of the code. Manifests, Metadata and Attributes Metadata and manifests are key aspects of managed code execution. The portions of an assembly that contains descriptive information about the types contained in the assembly, the members exposed by the assembly and the resources required by the assembly are called manifests. Metadata is contained within the manifest. This metadata describes the assembly and some of it is generated by the language compiler at compile time. Other metadata may be added by the developer at design time. Declarations added to the code to describe or modify some aspect of the codes behavior at r untime are known as Attributes. These are stored with an assembly as metadata. They serve many useful purposes in the .NET Framework Object Orientation in the .NET Framework Objects are the core of Object oriented programming. Classes are blueprints of objects and contain all the methods and properties of the object. Encapsulation, inheritance and polymorphism are attributes of an object. Encapsulation means the ability of an object to hide its internal data from outside view and allow access to only that data that is publicly available. Inheritance is the ability to derive one class from another. New classes can be created from existing classes and the new class inherits all the properties and methods of the old class and new methods and events can be added to the new class. This is useful when users want to create specialized classes. Polymorphism is the ability of multiple classes derived from the same base class to expose methods in the same name, regardless of the underlying process of implementation.

Rapid Development and Reuse The object orientation of the .NET Framework provides for faster development and deployment of applications. The use of classes, derived classes to provide common functionality has gone a long way in reducing development time. Object orientation is also the crucial element in the development of the code-behind concept and the latest code beside concept. Code behind allows developers to separate executable code form the HTML markup of the user interface. The executable code is placed in a module called code behind file. This file contains a class that inherits from the Page class. The ASP.NET page inherits from codebehind class and the two are compiled at runtime into a single executable assembly. The BETA 2.0 has added a number of functionalities to aid in rapid development. We will be looking at these changes in the next unit Whats new in BETA 2.0 Choosing a Language An important aspect of the .NET framework is that developers can continue to use the language of their choice in application development. The cross language interoperability in .NET makes it possible to create an application in any .NET supported language as all languages will work together smoothly using the CLR which translates all languages into Intermediary language.

WHAT REALLY HAPPENS


Intermediate Language (IL) Code This is the code that was produced by the compiler as it compiled the source code. IL is later compiled by the CLR into native CPU instructions.

NAMESPACES

The .NET Framework is made up of hundreds of classes. Many of the applications that you build in .NET are going to take advantage of these classes in one way or another. Because the number of classes is so large and you will need to get at them in a logical fashion, the .NET Framework organizes these classes into a class structure called a namespace. There are a number of namespaces, and they are organized in an understandable and straightforward way. You can import a namespace into your application in the following manner:
VB
Imports System.Data Imports System.Data.OleDb

C#
using System.Data; using System.Data.OleDb;

Or in your ASPNet pages for (VB and C#)


<%@ Import Namespace="System.Data" %> <%@ Import Namespace="System.Data.OleDb" %>

NAMESPACE
Namespace System Description Provides base data types and almost 100 classes that deal with situations like exception handling, mathematical functions, and garbage collection.

System.CodeDom
System.Collections System.Component Model System.Configuratio n System.Data

Provides the classes needed to produce source files in all the .NET languages.
Provides access to collection classes such as lists, queues, bit arrays, hash tables, and dictionaries. Provides classes that are used to implement runtime and design-time behaviors of components and controls. Provides classes and interfaces that allow you to programmatically access the various configuration files that are on your system, such as the web.config and the machine.config files. Provides classes that allow data access and manipulation to SQL Server and OleDb data sources. These classes make up the ADO.NET architecture. Provides classes that allow you to debug and trace your application. There are classes to interact with event logs, performance counters, and system

System.Diagnostics

NAMESPACE
Namespace Description System.DirectorySer Provides classes that allow you to access Active Directory. vices System.Drawing System.EnterpriseS ervices System.Globalizatio n System.IO Provides classes that allow you to access the basic and advanced features of the new GDI+ graphics functionality. Provides classes that allow you to access COM+ services. Provides classes that access the global system variables, such as calendar display, date and time settings, and currency display settings. Provides classes that allow access to file and stream control and manipulation.

System.Managemen Provides access to a collection of management information and events t about the system, devices, and applications designed for the Windows Management Instrumentation (WMI) infrastructure.

System.Messaging
System.Net

Provides classes that allow you to access message queue controls and manipulators.
Provides access to classes that control network services. These classes also allow control over the system s sockets.

NAMESPACES
Namespace System.Reflection System.Resources System.Runtime.Remotin g System.Security System.ServiceProcess System.Text System.Threading System.Timers Description Provides classes that allow control to create and invoke loaded types, methods, and fields. Provides classes that allow you to create and manage culturespecific resources. Provides classes that allow the management of remote objects in a distributed environment. Provides classes that allow access to authentication, authorization, cryptography, permissions, and policies. Provides classes that give control over Windows services. Provides classes for working with and manipulating text strings. Provides classes for threading issues and allows you to create multithreaded applications. Provides the capability to raise events on specified intervals.

NAMESPACES
Namespace System.Web System.Web.Services System.Windows.Forms System.Xml Description Provides numerous classes that are used in ASP.NET Web application development. Provides classes that are used throughout this book to build, deploy, and consume Web services. Provides classes to build and deploy Windows Forms applications. Provides classes to work with and manipulate XML data.

Injazat.LetsStartHere

TOOLS PROVIDED BY THE .NET FRAMEWORK

The different types of tools provided are Configuration and Deployment tools, debugging tools, security tools and General tools.
Description This tool is to facilitate the administrator or the installation program to update the script maps for ASP.NET application. This helps point the ASP.NET ISAPI version associated with the tool and also to perform other configuration operations. This tool is used for viewing and manipulating the contents of the global assembly cache using the Windows explorer. This tool helps generate a file with an assembly manifest from one or more files that are either resource files or MISL files (Microsoft Intermediate Language files). This tool is used to read the metadata within an assembly and adds the necessary entries to the registry. This in turn allows the COM clients to create .NET Framework classes transparently. This tool is used to display details of failed assembly binds so that users can diagnose why the .NET framework cannot locate an assembly at runtime. Allows you to configure the CorFlags section of the header of a portable executable image.

Tool ASP.NET IIS Registration Tool (Aspnet_regiis.exe) The Assembly Cache Viewer(Shfusion.dll) Assembly Linker (Al.exe)

Assembly Registration Tool (Regasm.exe) The Assembly binding log viewer (Fuslogvw.exe) CorFlags Conversion Tool (CorFlags.exe) Global Assembly Cache Tool Allows you to view and manipulate the contents of the global assembly cache and download cache. While Shfusion.dll provides similar functionality, you can use Gacutil.exe from build (Gacutil.exe) scripts, makefile files, and batch files. Installer Tool (Installutil.exe) This tool helps the user install or uninstall server resources by executing the installer components of a specified assembly. Lists or removes all existing stores for the currently logged-on user. Isolated Storage Tool (Storedm.exe) This tool creates a native image from a managed assembly and installs it in the native image Native Image Generator cache on the local computer. (Ngen.exe) The .NET Framework security policy and applications that use remoting services are managed The .NET Framework by this graphical user interface. The global assembly cache can be managed ant configured Configuration Tool. using this tool. (Mscorcfg.msc)

TOOLS PROVIDED BY THE .NET FRAMEWORK


Tool Description The .NET services Installation The managed classes are added to Windows 2000 component services using this tool. The services are loaded and registered into the assembly and the type libraries are generated, tool (Regsvcs.exe) registered and installed into an existing COM + 1.0 application. XML Serializer Generator Tool(Sgen.exe) Soapsuds Tool (Soapsuds.exe) Type Library Exporter (Tlbexp.exe) Type Library Exporter (Tlbimp.exe) Web Services Description Language tool. (Wsdl.exe) The XML serialization assembly for types in a specified assembly is created by this tool. This helps in improving runtime performance of the System.Xml.Serialization.XmlSerializer This tool helps the user compile client applications that communicated with XML Web services using remoting. Generates a type library from a common language runtime assembly. The type definitions found within a COM type library is converted into equivalent definitions managed in metadata format. This Generates code for XML Web services and XML Web services clients from Web Services Description Language (WSDL) contract files, XML Schema Definition (XSD) schema files, and .discomap discovery documents.

Web Services Discovery Tool This tool is used to discover URLs of XML Webservices located on the server and saves (Disco.exe) documents related to the XML web service on a local disk. XML Schema Definition tool(Xsd.exe) Microsoft CLR Debugger (DbgCLR.exe) Runtime Debugger (Cordbg.exe) This tool helps generate XML schemas that follow th XSD language proposed by the World Wide Web Consortium (W3C). It also generates common runtime language classes and Data Set classes from an XSD schema file. The graphical user interface provided by this tool helps application developers find and fix bugs in programs that target the runtime. This tool provides a command line debugging service that uses the Common Language Runtime Debug API to find and fix bugs in programs that target the runtime.

TOOLS PROVIDED BY THE .NET FRAMEWORK


Tool
Certificate Creation Tool (Makecert.exe)
Certificate Manager Tool (Certmgr.exe) Certificate Verification Tool (Chktrust.exe)

Description
This tool generates X.509 certificates for testing purposes only.
This tool Manages certificates, certificate trust lists (CTLs), and certificate revocation lists (CRLs).

This tool is useful in the verification of the validity of a file signed with X.509 certification. This tool ships with the .NET Framework SDK version 1.0 and 1.1. For later versions users must use the Sign Tool (signtool.exe) Code Access Security Policy Tool (Caspol.exe) This tool allows users examine and modify machine, user, and enterprise-level code access security policies Signs a portable executable (PE) file with an Authenticode digital signature. The File Signing Tool only ships with the File Signing Tool (Signcode.exe) .NET Framework SDK version 1.0 and 1.1. In later versions of the .NET Framework SDK, use the Sign Tool (signtool.exe) utility instead. Displays the minimal, optional, and refused permission sets requested by an assembly. You can also use this tool to Permissions View Tool (Permview.exe) view all declarative security used by an assembly. Performs MSIL type safety verification checks and metadata validation checks on a specified assembly. PEVerify Tool (PEverify.exe) Policy Migration Tool (Migpole.exe) Secutil Tool (Secutil.exe) Set Registry Tool (Setreg.exe) Migrates security policy between two compatible versions of the .NET Framework. Extracts strong name public key information or Authenticode publisher certificates from an assembly, in a format that can be incorporated into code. Allows you to change the registry settings for the Software Publishing State keys, which control the behavior of the certificate verification process. The Set Registry tool only ships with the .NET Framework SDK version 1.0 and 1.1. In later versions of the .NET Framework SDK, use the Sign Tool (signtool.exe) utility instead. Digitally signs files, verifies signatures in files, and time stamps files. Creates, for test purposes only, a Software Publisher's Certificate (SPC) from one or more X.509 certificates. Helps create assemblies with strong names. Sn.exe provides options for key management, signature generation, and signature verification. Reads text files that contain licensing information and produces a .licenses file that can be embedded in a common language runtime executable. Allows you to quickly generate an early-bound class in C#, Visual Basic, or JScript for a specified Windows Management Instrumentation (WMI) class. Generates a PE file from Microsoft intermediate language (MSIL). You can run the resulting executable, which contains MSIL code and the required metadata, to determine whether the MSIL code performs as expected. Takes a PE file that contains MSIL code and creates a text file suitable as input to the MSIL Assembler (Ilasm.exe). Converts text files and .resx (XML-based resource format) files to .NET common language runtime binary .resources files that can be embedded in a runtime binary executable or compiled into satellite assemblies. Converts type definitions in a COM type library for an ActiveX control into a Windows Forms control.

Sign Tool (signtool.exe) Software Publisher Certificate Test Tool (Cert2spc.exe) Strong Name Tool (Sn.exe) License Compiler (Lc.exe) Management Strongly Typed Class Generator (Mgmtclassgen.exe) MSIL Assembler (Ilasm.exe) MSIL Disassembler (Ildasm.exe) Resource File Generator Tool (Resgen.exe) Windows Forms ActiveX Control Importer (Aximp.exe) Windows Forms Class Viewer (Wincv.exe)

Finds managed classes matching a specified search pattern, and displays information about those classes using the Reflection API. The Windows Forms Class Viewer only ships with the .NET Framework SDK version 1.0 and 1.1. Windows Forms Resource Editor (Winres.exe) Allows you to quickly and easily localize Windows Forms forms.

THE COMMON TYPE SYSTEM

Field. A data variable that is part of the objects state. Fields are identified by their name and type. Method. A function that performs an operation on the object, often changing the objects state. Methods have a name, signature, and modifiers. The signature specifies the calling convention, number of parameters (and their sequence), the types of the parameters, and the type of value returned by the method. Property To the caller, this member looks like a field. But to the type implementer, this member looks like a method (or two). Properties allow an implementer to validate input parameters and object state before accessing the value and to calculate a value only when necessary; they also allow a user of the type to have simplified syntax. Finally, properties also allow you to create read-only or write-only fields. Event. A notification mechanism between an object and other interested objects.

CONTROLLING ACCESS TO A METHOD OR FIELD

Private Callable only by other methods in the same class type. Family Callable by derived types, regardless of whether they are within the same assembly. Note that many languages (like C++ and C#) refer to family as protected. Family and Assembly Callable by derived types, but only if the derived type is defined in the same assembly. Assembly. Callable by any code in the same assembly. Note that many languages refer to assembly as internal. Family or Assembly Callable by derived types in any assembly and by any types in the same assembly. Note that C# refers to family or assembly as protected internal. Public. Callable by any code in any assembly.

USING VALUE TYPES


There are three general value types: Built-in types User-defined types Enumerations

BUILT-IN VALUE TYPES

BEST PRACTICES Optimizing performance with built-in types The runtime optimizes the performance of 32-bit integer types (Int32 and UInt32), so use those types for counters and other frequently accessed integral variables. For floating-point operations, Double is the most efficient type because those operations are optimized by hardware.
Class name Description An 8-bit unsigned integer. An 8-bit signed integer. Not CLS-compliant. A 16-bit signed integer. A 32-bit signed integer. A 64-bit signed integer. A 16-bit unsigned integer. Not CLS-compliant. A 32-bit unsigned integer. Not CLS-compliant.

Category

Byte SByte Int16 Int32


Integer

Visual Basic data type Byte SByte Short Integer Long UShort UInteger ULong Single Double Boolean Char Decimal IntPtr

C# data type byte sbyte short int long ushort uint ulong float double bool char decimal IntPtr

Int64 UInt16 UInt32 UInt64

C++ data type unsigned char char -orsigned char short int -orlong __int64 unsigned short

JScript data type Byte SByte short int long UInt16 UInt32 UInt64 float double bool char Decimal IntPtr

unsigned int -orunsigned long


unsigned __int64 float double bool wchar_t Decimal IntPtr

A 64-bit unsigned integer. Not CLS-compliant. Single A single-precision (32-bit) floating-point number. Floating point Double A double-precision (64-bit) floating-point number. Logical Boolean A Boolean value (true or false). Char A Unicode (16-bit) character. Decimal A decimal (128-bit) value.

IntPtr
Other

A signed integer whose size depends on the underlying platform (a 32-bit value on a 32-bit platform and a 64-bit value on a 64-bit platform). An unsigned integer whose size depends on the underlying platform (a 32- bit value on a 32-bit

No built-in type. No built-in type. No built-in type.

UIntPtr platform and a 64-bit value on a 64-bit platform).


Not CLS-compliant. Class objects

UIntPtr

UIntPtr

UIntPtr

UIntPtr Object String

Object The root of the object hierarchy. String


An immutable, fixed-length string of Unicode characters.

No built-in type. No built-in type. No built-in type. Object object Object* String string String*

C# 4.0 VS. VISUAL BASIC 10

This is how close will become C# and VB in next release: C# 4.0 * Named/Optional Parameters * Dynamic Scoping Statement Lambdas Multiline Lambdas Auto-Implemented Properties Collection Initializers * Generic Variance * Extension Properties Visual Basic 10 Named/Optional Parameters Dynamic Scoping * Statement Lambdas * Multiline Lambdas * Auto-Implemented Properties * Collection Initializers * Generic Variance * Extension Properties

The items in * black-bold are new features

Das könnte Ihnen auch gefallen