Dot Net Framework FAQ's

Embed Size (px)

Citation preview

  • 8/14/2019 Dot Net Framework FAQ's

    1/5

    1. What is .NET?

    .NET is a general-purpose software development platform, similar to Java. At its coreis a virtual machine (called as CLR) that turns intermediate language (IL) intomachine code. High-level language compilers for C#, VB.NET and C++ are providedto turn source code into IL. C# is a new programming language, very similar to Java.

    An extensive class library is included, featuring all the functionality one might expectfrom a contempory development platform - windows GUI development (WindowsForms), database access (ADO.NET), web development (ASP.NET), web services,XML etc.

    2. What platforms does .NET run on?

    Currently, it is supported on Windows 98, Windows 2000/2003, Windows XP andWindows Vista. ASP.NET integrates with Internet Information Server (IIS) and thusrequires that IIS be installed.

    .NET Compcat Framework runs on Windows CE or Windows Mobile.

    Mono is an open source project to provide .Net on Linux.

    3. What is the CLI? Is it the same as the CLR?

    The CLI (Common Language Infrastructure) is the definiton of the fundamentals ofthe .NET framework - the Common Type System (CTS), metadata, the VirtualExecution Environment (VES) and its use of intermediate language (IL), and thesupport of multiple programming languages via the Common Language Specification(CLS).

    The CLR (Common Language Runtime) is Microsoft's primary implementation of theCLI. Other implementations are; the .NET Compact Framework for mobile devices,non-Microsoft CLI implementations like Mono and DotGNU Portable.NET.

    4. What is IL?

    IL = Intermediate Language. Also known as MSIL (Microsoft Intermediate Language)or CIL (Common Intermediate Language). All .NET source code (of any language) iscompiled to IL during development. The IL is then converted to machine code at run-time by a Just-In-Time (JIT) compiler. Just like how Java programs are converted toBytecode, C# and VB.NET code is converted to IL.

    5. What versions of .NET and when they were released?

    Microsoft first announced .NET in June,2000. The following were the offical releasesof .NET.

    .NET 1.0 was relased in Feb,2002 .NET 1.1 was relased in Apr,2003 .NET 2.0 was relased in Nov,2005 .NET 3.0 was relased in Nov,2006

  • 8/14/2019 Dot Net Framework FAQ's

    2/5

    .NET 3.5 was relased in Nov,2007

    The following table shows ASP.NET and C# versions along with .NET versions.

    .NET ASP.NET C#

    1.0 1.0 1.0

    1.1 1.1 1.1

    2.0 2.0 2.0

    3.0

    3.5 3.5 3.0

    6. What's the major additon in the latest versions of .NET 3.5?

    LINQ (Language Integrated Query) is a new way to access database, xml documentsand collections. It enables programmers to access all data sources with expressions

    in C# and VB.NET. For example, we can access database without using any SQLusing C# or VB.NET expressions.

    7. What is C#?

    C# is a new language designed by Microsoft to work with the .NET framework. Intheir "Introduction to C#" whitepaper, Microsoft describe C# as follows: "C# is asimple, modern, object oriented, and type-safe programming language derived fromC and C++. C# (pronounced C sharp ) is firmly planted in the C and C++ family tree of languages, and will immediately be familiar to C and C++programmers. C# aims to combine the high productivity of Visual Basic and the rawpower of C++."

    C# (or VB.NET) can be used to develop all types of applications - Console, Windows,Web, Web Services and Mobile.

    What does 'Managed code' mean in the .NET?

    The .NET framework provides several core run-time services to the programs thatrun within it - for example exception handling, memory management and security.For these services to work, the code must provide a minimum level of information tothe runtime. Such code is called managed code.

    Managed data: This is data that is allocated and freed by the .NET runtime's garbage

    collector.

    9. What is an assembly?

    Assemblies are the building blocks of .NET Framework applications; they form thefundamental unit of deployment, version control, reuse, activation scoping, andsecurity permissions. An assembly is a collection of types and resources that arebuilt to work together and form a logical unit of functionality. An assembly provides

  • 8/14/2019 Dot Net Framework FAQ's

    3/5

    the common language runtime with the information it needs to be aware of typeimplementations. To the runtime, a type does not exist outside the context of anassembly. An assembly may be either a .EXE or .DLL file. It contains code that thecommon language runtime executes.

    10. What are different types of Assemblies?

    Assemblies are classified as private assemblies and global assemblies.

    Private assemblies are simple and copied to bin directory of the application that isusing it.

    Shared assemblies (also called as gobal assemblies) are copied to a single locationcalled GAC (Global assembly cache). Hence, shared assemblies are not copied in theprivate folders of each calling application.

    Each shared assembly has a four part name including its name, version, public keytoken and culture information. The public key token and version information makes it

    almost impossible for two different assemblies with the same name or for two similarassemblies with different version to mix with each other.

    11. What is the difference between a namespace and an assembly name?

    A namespace is a logical naming scheme for types in which a simple type name,such as MyType, is preceded with a dot-separated hierarchical name. The .NETFramework uses a hierarchical naming scheme for grouping types into logicalcategories of related functionality.

    The concept of a namespace is not related to that of an assembly. A single assemblymay contain types whose hierarchical names have different namespace roots, and a

    logical namespace root may span multiple assemblies.

    In the .NET Framework, a namespace is a logical design-time naming convenience,whereas an assembly establishes the name scope for types at run time.

    12. What is meant by un-safe code?

    By un-safe code, it means that the managed program can access the memoryaddress using pointers. There are two points to remember here:

    Un-safe code is different from un-managed as it is still managed bythe CLR You still can not perform pointer arithmetic in un-safe code.

    13. What is the difference between Unmanaged and Unsafe code?

    Un-managed code runs outside the Common Language Runtime (CLR) control whilethe unsafe code runs inside the CLRs control. Both un-safe and un-managedcodes may use pointers and direct memory addresses.

  • 8/14/2019 Dot Net Framework FAQ's

    4/5

    14. What are the shortcomings of MS.NET platform?

    The foremost short coming of .NET platform is that it is still the propriety ofMicrosoft. It is more coupled with the Microsoft Windows operating system and isimplemented only on Microsoft Windows successfully. MS.NET desktop applicationscan run only on Microsoft Windows, Web based applications and web services can

    only be deployed on Microsoft Internet Information Server (IIS). Since, dot netframework contains a lot of utilities, components, and framework class libraries, thesize of downloadable framework is quite large (25MB compared to 5MB size of JVM).The managed .Net applications are somewhat slower to start and run than thetraditional Win32 applications. The compiled code of .Net managed applications iseasier to de-compile back to the source code.

    15. Can I use the Win32 API from a .NET Framework program?

    Using platform invoke it's possible. .NET Framework programs can access nativecode libraries by means of static DLL entry points. Here is an example of C# callingthe Win32 MessageBox function:

    using System;using System.Runtime.InteropServices;

    class MainApp{

    [DllImport("user32.dll", EntryPoint="MessageBox")]public static extern int MessageBox(int hWnd, String strMessage, String

    strCaption, uint uiType);

    public static void Main(){

    MessageBox(0, "This is PInvoke in operation!", ".NET", 0 );}

    }

    16. What is serialization in .NET and what are the ways to controlserialization?

    Serialization is the process of converting an object into a stream of bytes. On theother hand Deserialization is the process of creating an object from a stream ofbytes. Serialization/Deserialization is used to transport or to persist objects.Serialization can be defined as the process of storing the state of an object to astorage medium.

    You can serialize an object to a stream, disk, memory, over a network, and so forth.Remoting uses serialization to pass objects "By Value" from one computer orapplication domain to another.

    XML serialization serializes only public properties and fields and does not preserveType fidelity. This is useful when you want to provide or consume data withoutrestricting the application that uses the data.

  • 8/14/2019 Dot Net Framework FAQ's

    5/5

    As XML is an open standard, it is an attractive choice for sharing data across theWeb. SOAP is also an open standard, which makes it an attractive choice too. Thereare two separate mechanisms provided by the .NET class library - XmlSerializer andSoapFormatter/BinaryFormatter. Microsoft uses XmlSerializer for Web Services, anduses SoapFormatter/BinaryFormatter for remoting. Both are available for use in yourown code.