Thursday, April 26, 2007

Interface and abstract feature in C#

In this I tryed to explain the Concept of Interface and abstract feature of C# with Examples


What's an Interface?
An interface is a reference type object with no implementation.


Why Use Interfaces?
To make our code more reusable, we can provide interfaces to our implementation. This ONLY works if we are disciplined about not altering interfaces after they have been deployed (that would cause the same cascading breaks that non-interface development does). We can always add functionality to an interface without breaking things, but if we alter the existing "hooks" into our implementation we loose one of the primary benefits of using the interface. This is the downside of interface based development. If interfaces are poorly designed and have to change or not easy to implement we will not receive the benefits of using them and all they achieve is to make our code more complex. We need to think out the interfaces very carefully at design time before getting too far into the implementation because once they are implemented and made available to other resources they should not change.

Here's a concrete example which Explains how to use Interface, Consider you want to become as Me!! , so what you need to do,…Do all the things which I am doing ..So I will declare what all the things which I will be doing (ItoBecomeasMe ) . And my follower who wants to become as me should Inherit me.


using System;

namespace Test
{
///
/// Summary description for testInterface.
///

public class testInterface
{
public testInterface()
{
//
// TODO: Add constructor logic here
//
}





// Interface I am declaring methods which I am did, If you want to become as me do those methods
public interface IToBecomeasMe
{

// I am declaring Methods which you should have to become as me
string myname{ get; set ;}
void DoBE () ;
bool IsPassed{get;}
void doCoding();

}






// My follower has to do all the things which I am doing
// so this class has to Implement all the methods of Base class

public class MyFollower : IToBecomeasMe
{

private bool test_IsPassed ;
private string name ;
private string mba_Degree ;

public string myname
{
get
{
return name ;

}
set
{
name = value ;
}
}

public void DoBE()
{
Console.Write("I must do BE") ;
}

// Compiler will Identify methods with method name and parameter
//type so it treat as this method diff than the above considering parameter type

public void DoBE( bool Fail)
{
Console.Write("Failed") ;
}
public bool IsPassed
{
get
{

return test_IsPassed ;
}
}


public void doCoding()
{
Console.Write("I must do Coding") ;
}


// This method is one which was not In Base class, the thing is You //must have all the Methods of Base class with your owned class
public void DoMBA()
{
Console.Write("I did BE and also MBA") ;
}

}





// My special follwer

//Abstract classes are one of the essential behaviors provided by .NET. Commonly, //you would like to make classes that only represent base classes, and don’t want/ //anyone to create objects of these class types. You can make use of abstract classes //to implement such functionality in C# using the modifier 'abstract'.
//An abstract class means that, no object of this class can be instantiated, but can //make derivations of this.

public abstract class MySpecialFollower : IToBecomeasMe
{


private bool test_IsPassed ;
private string name ;
private string mba_Degree ;


// Declare abstract class which force the derived class to override this method which make him special
public abstract int goToUS(int year) ;


// Implementing the other methods
public string myname
{
get
{
return name ;

}
set
{
name = value ;
}
}

public void DoBE()
{
Console.Write("I must do BE") ;
}

public bool IsPassed
{
get
{

return test_IsPassed ;
}
}


public void doCoding()
{
Console.Write("I must do Coding") ;
}
// This method is one which was not In Base class, the thing is You //must have all the Methods of Base class with your owned class

public void DoMBA()
{
Console.Write("I did BE and also MBA") ;
}

}
}




// In this method I will create a derived class which inherits all the methods of Special Follower .

public class FollwerofSpecialPerson : testInterface.MySpecialFollower
{


// this will force to user to add method goToUS(year) , otherwise throws error
//Also, note that an abstract class does not mean that it should contain abstract members. //Even we can have an abstract class only with non abstract members.


public override int goToUS(int year)
{
int money ;
// earn lots of money
for ( money = 0 ; money <= 10000 ; money++ )
{

money = money * year ;
}

return money ;
}


// another method with diff return type who settel in US
public bool goToUS(bool settel)
{
int money ;
// earn lots of money
for ( money = 0 ; money <= 10000 ; money++ )
{

money = money * money ;
}

return true ;
}

}
}



static void Main (string[] args)
{

//this throws error becoes we cant create Instance of abstract class
// testInterface.IToBecomeasMe me = new testInterface.MySpecialFollower
();
testInterface.IToBecomeasMe me = new testInterface.MyFollower();
me.myname = "BABU" ;
me.DoBE() ;
if (me.IsPassed)
{
me.doCoding() ;
}
}
}
}

Note :

An abstract class cannot be a sealed class. I.e. the following declaration is
incorrect.


abstract sealed class absClass
{
}
Declaration of abstract methods are only allowed in abstract
classes.
An abstract method cannot be private

The access modifier of the abstract method should be same in both
the abstract class and its derived class. If you declare an abstract method as
protected, it should be protected in its derived class. Otherwise, the compiler will raise an error.

Diff. between Interface and abstract

An interface is not a class. It is an entity that is defined by the word Interface. An interface has no implementation; it only has the signature or in other words, just the definition of the methods without the body. As one of the similarities to Abstract class, it is a contract that is used to define hierarchies for all subclasses or it defines specific set of methods and their arguments. The main difference between them is that a class can implement more than one interface but can only inherit from one abstract class. Since C# doesn’t support multiple inheritance, interfaces are used to implement multiple inheritance.

An abstract class is a special kind of class that cannot be instantiated. So the question is why we need a class that cannot be instantiated? An abstract class is only to be sub-classed (inherited from). In other words, it only allows other classes to inherit from it but cannot be instantiated. The advantage is that it enforces certain hierarchies for all the subclasses. In simple words, it is a kind of contract that forces all the subclasses to carry on the same hierarchies or standards.



Wednesday, April 25, 2007

Kannada In Software

Even though the main software revolution is happening In Bangalore and so many Kannadiga's are working in software field, there are only few activities going on to bring Kannada Software to main stream, and there are lots of people who are in software and not aware of Kannada software which is said to be more efficient to use compare to other languages

I proudly tried to give a brief introduction of Baraha which is working on developing software in Kannada and also in other Indian language
For more details visit http://www.baraha.com/

About Baraha

Baraha means 'writing' in Kannada. Baraha is a transliteration based application which converts 'Indian language text written in English' to their own respective scripts.

The first public release of Baraha software was made on January 1998. This initial release was developed with an intention to provide a free, easy to use Kannada language software to enable even non-computer professionals to use Kannada in computers thereby promoting Kannada language in the cyber world. Today hundreds of thousands of Indians are using Baraha for sending e-mails to friends & family across the world in their mother tongue. Many websites have been created using Baraha. Various Indian organizations around the world are publishing their newsletters using Baraha. Government & private offices, schools, litterateurs, journalists are among those who have been using Baraha for documentation purposes.
The biggest challenge for use of Indian languages is the keyboard. At present, usage of English language & English keyboard(QWERTY) in computers is inevitable. One has to use the English keyboard only to type Indian language text. Today, there exist many different keyboard layouts for typing Indian languages. Many such layouts are based on the earlier typewriter designs, which are not at all relevant for the intelligent computers. It is also very difficult and confusing for a common user, who most of the time uses the English keyboard, to switch to one such keyboard for quickly typing an email in Kannada or Hindi.

Baraha breaks the keyboard barrier for Indian languages by using a transliteration scheme in which any Indian language word can be typed using the standard English keyboard. Baraha user doesn't feel any discomfort when he switches between typing Indian language text and English. In fact, writing in Baraha is as simple and easy as writing our names in English! Kannada and Hindi text such as cheluva kannaDa nADu, merA bhArat mahAn can be typed as shown.

Many Indian language software were created based on True Type fonts (ANSI encoding) many years before Windows/Linux re-introduced them using Open Type fonts (Unicode encoding). Even today, majority of the Indian language content is being created using TrueType fonts and almost all Indian publications use ANSI based TrueType fonts for printing and online publications. Baraha breaks the barrier between ANSI and Unicode. Using Baraha, one can effortlessly convert text between ANSI and Unicode. For example, there are a lot of Tamil documents that are created using True Type fonts based on TSCII - which is a popular standard for Tamil. These documents can be converted to Unicode with a few keystrokes! Similarly, when a user on Windows 98 - that doesn't support Unicode, receives a Hindi email in Unicode, he can convert it to ANSI and read it.

Baraha breaks the script barrier between different Indian languages. All the Indian scripts are derived from the Brahmi script, which is also the underlying concept in Baraha. Baraha uses a common code-set for representing all the Indian languages. So, it is possible to convert text from one script to another. For example, lets say a Malayalam user who understands Hindi language receives a Hindi email. If the user is not fluent in reading Devanagari script, then he can convert the email to Malayalam script and read it.

One of the main objectives of Baraha is "portability of data". Baraha can export the data in various data formats such as ANSI text, Unicode text, RTF, HTML. User can convert documents to Unicode format by a few clicks of mouse, which means the documents that are created in Baraha, stay relevant in the future and will never become obsolete.

"The language is not just a means of communication. Instead, it is the only means that can save the culture of its people." Baraha was made freeware in order to motivate Indians to communicate in their languages on computers. We believe that only an easy to use, good quality, free Indian language software can jump-start the extensive usage of Indian language on computers, which today is dominated by English. Baraha can be freely downloaded from the Internet and can be distributed to others.



Kannada script processing API reference

Files:C/C++ Header: brh_kanapi_api.hVisual Basic definition:

brh_kanapi.basLibrary: brh_kanapi.dllImport Library: brh_kanapi.lib
Kannada Data Conversion Flow.
BrhRegister() function registers the Kannada Data Processing SDK. This function should be called before you call any other functions in the DLL.

VC++:BOOL BrhRegister( LPCSTR strCompanyName , LPCSTR strRegKey );

VB:Declare Function BrhRegister Lib "brh_kanapi.dll" (ByVal strCompanyName As String, ByVal strRegKey As String) As Long

VC++ COM:HRESULT Register (/*[in]*/ BSTR strCompanyName, /*[in]*/ BSTR strRegKey, /*[out, retval]*/ BOOL* bOutput);

VB COM:bOutput = kanapi.Register(strCompanyName, strRegKey)
Parameters:strCompanyName: Specifies the name of the company/person to which/whom this product is registered.strRegkey: Specifies the registration key of the product.

Return Value: If the function is successful, the return value is 1. If the function fails, the return value is 0.

Remarks:If you don't have valid registration key, then you should not call BrhRegister() or kanapi.Register() function at all. This causes BRH_KANAPI to run in the demo mode.

In the demo mode only the first 32 bytes (32 characters in the case of UNICODE) in the input string are converted to the specified output format by the BrhConvert & BrhConvertEx functions.

In the demo mode only first 16 bytes (16 characters in the case of UNICODE) are compared by BrhCompare & BrhCompareEx functions.
BrhConvert() function converts the input string represented in "KANTRANS" format to "ANSI" output data format. This function internally calls BrhConvertEx() function.

VC++:long BrhConvert( LPCSTR strInput , LPSTR strOutput , long nMaxCount );

VB:Declare Function BrhConvert Lib "brh_kanapi.dll" (ByVal strInput As String, ByVal strOutput As String, ByVal nMaxCount As Long) As Long
VC++ COM:HRESULT Convert (/*[in]*/ BSTR strInput, /*[out, retval]*/ BSTR* strOutput);

VB COM:strOutput = kanapi.Convert(strInput)
Parameters:strInput: Points to the string in "KANTRANS" format to be converted.strOutput: Points to a buffer that receives the converted string in "ANSI" format.nMaxCount: Specifies the size, in bytes, of the buffer pointed to by the strOutput parameter.

Return Value: If the function succeeds, and nMaxCount is nonzero, the return value is the number of bytes written to the buffer pointed to by strOutput.If the function succeeds, and nMaxCount is zero, the return value is the required size, in bytes, for a buffer that can receive the translated string.If the function fails, the return value is zero.

BrhConvertEx() function converts the input string represented in strInputFormat format to the output format specified by strOutputFormat.
VC++:long BrhConvertEx( LPCSTR strInput , LPCSTR strInputFormat , LPSTR strOutput , LPCSTR strOutputFormat , long nMaxCount );

VB:Declare Function BrhConvertEx Lib "brh_kanapi.dll" (ByVal strInput As String, ByVal strInputFormat As String, ByVal strOutput As String, ByVal strOutputFormat As String, ByVal nMaxCount As Long) As Long
VC++ COM:HRESULT ConvertEx (/*[in]*/ BSTR strInput, /*[in]*/ BSTR strInputFormat, /*[in]*/ BSTR strOutputFormat, /*[out, retval]*/ BSTR* strOutput);

VB COM:strOutput = kanapi.ConvertEx(strInput, strInputFormat, strOutputFormat)
Parameters:strInput: Points to the string in strInputFormat format to be converted.strInputFormat: Specifies the input string format.strOutput: Points to a buffer that receives the converted string in strOutputFormat format.strOutputFormat: Specifies the output string format.nMaxCount:Specifies the size, in bytes (UNICODE characters if strOutputFormat = "UNICODE"), of the buffer pointed to by the strOutput parameter.

Return Value: If the function succeeds, and nMaxCount is nonzero, the return value is the number of bytes (UNICODE characters if strOutputFormat = "UNICODE") written to the buffer pointed to by strOutput.If the function succeeds, and nMaxCount is zero, the return value is the required size, in bytes, for a buffer that can receive the translated string.If the function fails, the return value is zero.

BrhCompare() function compares two Kannada strings represented in "KANTRANS" format. This function internally calls BrhCompareEx() function.

VC++:long BrhCompare( LPCSTR strString1 , LPCSTR strString2 , BOOL bMemcmp );

VB:Declare Function BrhCompare Lib "brh_kanapi.dll" (ByVal strString1 As String, ByVal strString2 As String, ByVal bMemcmp As Long) As Long

VC++ COM:HRESULT Compare (/*[in]*/ BSTR strString1, /*[in]*/ BSTR strString2, /*[in]*/ BOOL bMemcmp, /*[out, retval]*/ long* lOutput);
VB COM:lOutput = kanapi.CompareEx(strString1, strString2, bMemcmp)
Parameters:strString1: Points to the first string in "KANTRANS" format.strString2: Points to the second string in "KANTRANS" format.bMemcmp : If 1, the strings are compared based on their binary values. If 0, a special comparison algorithm is used.
Return Value: Returns 0 if strString1 identical to strString2.Returns -ve value if strString1 less than strString2. Returns +ve value if strString1 greater than strString2.

Remarks:In the special comparison, the vedic, music, laghu, & guru symbols are ignored. Also, 'ra' kaara & 'repha' are matched.Ex: If bMemcmp is 0, then strings "karma" & "kaRma" are evaluated as identical.

BrhCompareEx() function compares two Kannada strings represented in various formats.

VC++:long BrhCompareEx( LPCSTR strString1 , LPCSTR strString1Format , LPCSTR strString2 , LPCSTR strString2Format , BOOL bMemcmp );

VB:Declare Function BrhCompareEx Lib "brh_kanapi.dll" (ByVal strString1 As String, ByVal strString1Format As String, ByVal strString2 As String, ByVal strString2Format As String, ByVal bMemcmp As Long ) As Long

VC++ COM:HRESULT CompareEx (/*[in]*/ BSTR strString1, /*[in]*/ BSTR strString1Format, /*[in]*/ BSTR strString2, /*[in]*/ BSTR strString2Format, /*[in]*/ BOOL bMemcmp, /*[out, retval]*/ long* lOutput);

VB COM:lOutput = kanapi.CompareEx(strString1, strString1Format, strString2, strString2Format, bMemcmp)

Parameters:strString1: Points to the first string.strString1Format: Specifies the first string format.strString2: Points to the second string.strString2Format: Specifies the second string format.bMemcmp : If 1, the strings are compared based on their binary values. If 0, a special comparison algorithm is used.

Return Value: Returns 0 if strString1 identical to strString2.Returns -ve value if strString1 less than strString2. Returns +ve value if strString1 greater than strString2.

Remarks:In the special comparison, the vedic, music, laghu, & guru symbols are ignored. Also, 'ra' kaara & 'repha' are matched.Ex: If bMemcmp is 0, then strings "karma" & "kaRma" are evaluated as identical.
BrhConvertDate() function converts the Date/Time strings to/from Kannada(KANTRANS) to English.

VC++:void BrhConvertDate( LPCSTR strInput, BOOL bFromEnglish , LPSTR strOutput, long nMaxCount);
VB:Declare Sub BrhConvertDate Lib "brh_kanapi.dll" (ByVal strInput As String, ByVal bFromEnglish as Long, ByVal strOutput As String, ByVal nMaxCount As Long )

VC++ COM:HRESULT ConvertDate (/*[in]*/ BSTR strInput, /*[in]*/ BOOL bFromEnglish , /*[in]*/ BSTR* strOutput);

VB COM:strOutput = kanapi.ConvertDate(strInput, bFromEnglish)
Parameters:strInput: Points to the input string to be converted.bFromEnglish: If 1 convert from English to KANTRANS. Else, convert from KANTRANS to English.strOutput: Points to the output string.nMaxCount: Specifies the size in bytes, of the buffer pointed to by the strOutput parameter.

Remarks:The Date/Time strings can be converted to/from English to KANTRANS format. The string can be later converted to other Kannada data formats.Ex: "Tuesday, January 23, 1968" is converted to "maMgaLavAra, janavari 23, 1968", when bFromEnglish is 1Ex: "mArch 15, 1972, 8:00 pUrvAhna" is converted to "MARCH 15, 1972, 8:00 AM", when bFromEnglish is 0.

Tuesday, April 24, 2007

Questions with Answer on ASP.NET

What is view state?
The web is stateless. But in ASP.NET, the state of a page is maintained in the in the page itself automatically. How? The values are encrypted and saved in hidden controls. this is done automatically by the ASP.NET. This can be switched off / on for a single control


Describe the role of inetinfo.exe, aspnet_isapi.dll andaspnet_wp.exe in the page loading process.
inetinfo.exe is theMicrosoft IIS server running, handling ASP.NET requests among other things.When an ASP.NET request is received (usually a file with .aspx extension), the ISAPI filter aspnet_isapi.dll takes care of it by passing the request tothe actual worker process aspnet_wp.exe.

What’s the difference between Response.Write() andResponse.Output.Write()?
Response.Output.Write() allows you to write formatted output.

What methods are fired during the page load?
Object Initialization
Load Viewstate Data
LoadPostData Processes Postback Data
Object Load
Raise PostBack Change Events
Process Client-Side PostBack Event
Prerender the Objects
ViewState Saved
Render To HTML
Disposal

When during the page processing cycle is ViewState available?
After the Init() and before the Page_Load(), or OnLoad() for a control.

What namespace does the Web page belong in the .NET Framework class hierarchy?
System.Web.UI.Page

Where do you store the information about the user’s locale?System.Web.UI.Page.Culture

What’s the difference between Codebehind="MyCode.aspx.cs" and Src="MyCode.aspx.cs"?
CodeBehind is relevant to Visual Studio.NET only.

What’s a bubbled event?
When you have a complex control, like DataGrid, writing an event processing routine for each object (cell, button, row, etc.) is quite tedious. The controls can bubble up their eventhandlers, allowing the main DataGrid event handler to take care of its constituents.

Suppose you want a certain ASP.NET function executed on MouseOver for a certain button. Where do you add an event handler?
Add an OnMouseOver attribute to the button. Example: btnSubmit.Attributes.Add("onmouseover","someClientCodeHere();");


What data types do the RangeValidator control support?
Integer, String, and Date.

Explain the differences between Server-side and Client-side code?
Server-side code executes on the server. Client-side code executes in the client's browser.

What type of code (server or client) is found in a Code-Behind class?
The answer is server-side code since code-behind is executed on the server. However, during the code-behind's execution on the server, it can render client-side code such as JavaScript to be processed in the clients browser. But just to be clear, code-behind executes on the server, thus making it server-side code.

Should user input data validation occur server-side or client-side? Why?
All user input data validation should occur on the server at a minimum. Additionally, client-side validation can be performed where deemed appropriate and feasable to provide a richer, more responsive experience for the user.

What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other?
Server.Transfer transfers page processing from one page directly to the next page without making a round-trip back to the client's browser. This provides a faster response with a little less overhead on the server. Server.Transfer does not update the clients url history list or current url. Response.Redirect is used to redirect the user's browser to another page or site. This performas a trip back to the client where the client's browser is redirected to the new page. The user's browser history list is updated to reflect the new address.

Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?
Valid answers are:· A DataSet can represent an entire relational database in memory, complete with tables, relations, and views.· A DataSet is designed to work without any continuing connection to the original data source.· Data in a DataSet is bulk-loaded, rather than being loaded on demand.· There's no concept of cursor types in a DataSet.· DataSets have no current record pointer You can use For Each loops to move through the data.· You can store many edits in a DataSet, and write them to the original data source in a single operation.· Though the DataSet is universal, other objects in ADO.NET come in different versions for different data sources.

What is the Global.asax used for?
The Global.asax (including the Global.asax.cs file) is used to implement application and session level events.

What are the Application_Start and Session_Start subroutines used for?This is where you can set the specific variables for the Application and Session objects.

Can you explain what inheritance is and an example of when you might use it?
When you want to inherit (use the functionality of) another class. Example: With a base class named Employee, a Manager class could be derived from the Employee base class.

Whats an assembly?
Assemblies are the building blocks of the .NET framework

Describe the difference between inline and code behind.
Inline code written along side the html in a page. Code-behind is code written in a separate file and referenced by the .aspx page.

Explain what a diffgram is, and a good use for one?
The DiffGram is one of the two XML formats that you can use to render DataSet object contents to XML. A good use is reading database data to an XML file to be sent to a Web Service.

Whats MSIL, and why should my developers need an appreciation of it if at all?
MSIL is the Microsoft Intermediate Language. All .NET compatible languages will get converted to MSIL. MSIL also allows the .NET Framework to JIT compile the assembly on the installed computer.

Which method do you invoke on the DataAdapter control to load your generated dataset with data?
The Fill() method.

Can you edit data in the Repeater control?
No, it just reads the information from its data source.

Which template must you provide, in order to display data in a Repeater control?
ItemTemplate.

How can you provide an alternating color scheme in a Repeater control?
Use the AlternatingItemTemplate.

What property must you set, and what method must you call in your code, in order to bind the data from a data source to the Repeater control?
You must set the DataSource property and call the DataBind method.

What base class do all Web Forms inherit from?
The Page class.

Name two properties common in every validation control?ControlToValidate property and Text property.

Which property on a Combo Box do you set with a column name, prior to setting the DataSource, to display data in the combo box?
DataTextField property.

Which control would you use if you needed to make sure the values in two different controls matched?
CompareValidator control. How many classes can a single .NET DLL contain?It can contain many classes

Why .NET?

Why .NET?

I was thinking what should I post to my blog as first Article , then I decided nothing more than this , Why .NET – Which changed my Life style and which is part of my life Its dotnet.

Like it or not,

.NET is the future of development not only for the Windows platform, but other operating systems as well. If you are not moving to .NET now, you should at least be keeping up to date with it and reevaluating it at regular intervals to determine when you will begin moving to it.
If you begin evaluating .NET now and plan for a smooth and timely migration, you will reap the benefits. However, if you wait too long, the future is quite predictable, and can easily be seen by looking at the DOS developer that we all know who refuses to admit Windows has arrived.

Why not Java?
This article is not a tirade or attack on Java. In general, this article is targeted at Win32 developers and not Java developers. But the question still arises, “Why .NET instead of Java?”. I shall compare .NET and Java and prognosticate on the future.
Java is an established platform with its own merits. This article merely states my reasons why I think .NET is important. I have only referenced the Java platform when a contrast or specific difference existed that I felt was of particular importance.
.NET is superior to Java as a platform in many areas, while Java is superior in others. The key difference though is that .NET will close the gap in the future with little need for change, while Java cannot close the gaps without a major redesign into something quite different than it is now.
Some advantages that .NET has over Java are:
Java is not just a platform, but a language. .NET is language independent. Adopting .NET does not force you to adopt a single, or even specific language. .NET can even support the Java language, and J# is very close to Java.
Language interoperability.
.NET can coexist with and even integrate with existing Win32 code.
Moving to Java from Win32 is a complete paradigm shift. Moving to .NET is a more natural path for Win32 developers.
Reasons for .NET

Though while not a technical reason, this is still a reason to learn .NET. Microsoft is spending a lot of money on marketing .NET, and wooing companies to move to it. Many managers responsible for such decisions are not very technical, but do trust Microsoft. They will move to .NET purely on the basis that Microsoft tells them it is the only future, and when they see their competitors move to .NET.
When companies move, they of course need developers Learning .NET now assures your future as an employable developer, and gives you a head start and more experience than other developers who wait to learn it at the last minute.

Pure Code
Applications can be compiled and executed on the .NET platform, yet still be not "pure" .NET applications. "Pure" is a subjective term, and not necessarily an official one. I will define a pure .NET application as having the following attributes:
100% Safe Code
100% Managed Code
P/Invoke Free
The ultimate goal of any .NET application is to use 100 % pure code and isolate all other code into separate assemblies. In a 100% .NET world all applications will run only pure code. Only device drivers, encryption, compression, and other such items shall run as unsafe code.

Managed Code
Managed code is code that is executed under the control of the .NET framework. Code that can be managed by the .NET framework is IL, or Intermediate Language based code. Unmanaged code contains CPU specific instructions produced by assembly language mnemonics, or a traditional compiler such as C++, or Delphi (.NET versions).
Languages such as C# and Visual Basic.NET produce only managed code. However Delphi, and especially C++ can produce mixed applications which contain both managed and unmanaged code.
Mixed mode applications can integrate with the .NET framework and allow easier phased migration from Win32. Mixed mode assemblies are also necessary for integrating with hardware. However, since a mixed mode application contains CPU and operating system specific information, this ties the .NET application to a specific CPU and operating system. Such applications therefore use .NET, but are do not run completely under the .NET framework and are not compatible with other .NET implementations such as Mono, the 64 bit .NET framework, and other future implementations.
Many server environments have security restrictions that only permit applications to be run if they are pure managed code. Unmanaged code items must be explicitly trusted by the administrator and are reserved for device drivers and the like.
In short, if any part of an application is unmanaged, the whole application should be considered unmanaged. If certain items such as hardware must be integrated with a managed wrapper is created. All such items should be created and deployed as separate isolated assemblies for easier management.

Safe Code
Safe code is code that strictly follows the rules of type safety of the .NET framework. Unsafe code is old code that does not follow such rules. Unsafe code permits use of pointers, machine specific byte orders, and language specific types. Unsafe code requires additional permissions to execute.
Assemblies can be checked with a tool called PEVerify to determine if it contains unsafe code. PEVerify is part of the .NET framework SDK.
P/Invoke Free
P/Invoke is an abbreviation for Platform Invoke and refers to the ability to make calls directly to the operating system without using the .NET FCL. In Windows, P/Invoke also allows calls to be made to user or vendor DLL's. P/Invoke is similar to JNI in Java.
Using P/Invoke does not make code unsafe or unmanaged. It does however cause the application to rely on items specific to the operating system. This again makes the application unable to run on Mono, and other future implementations. P/Invoke should be avoided and functions in the FCL should be used instead when possible.

Platform Potential
Because IL is generic, it is not tied to any particular CPU or hardware platform. While IL is currently only supported on Windows, its design is specifically built with other platforms in mind. On Linux, there is already a project called Mono to allow IL code to run on Linux. In the future, other platforms will implement IL execution as well.

Language Neutral
.NET is language neutral. The three most common languages in .NET are C#, Visual Basic, and Delphi. But many others exist for .NET as well, including Fortran, Smalltalk, and others.
But .NET is more than just language neutral. .NET brings all the languages together through its CLR (Common Language Runtime) and CTS (Common Type System). The CLR and CTS allow all the languages to use assemblies produced by other languages as if they were produced by the same language. There is no more awkward translation of parameter types, calling conventions, or naming conventions. Now, C# users can use all code produced by Delphi programmers, Visual Basic users can use all code produced by C# developers, and any combination of languages. No longer are developers segregated by language and forced to interact only through difficult and awkward exports.
Imagine, if all of the sudden the universal translator from Star Trek were made available today enabling Russians to speak directly to Germans, to Dutch, to Spanish, to any language. Each using their own native tongue, yet each hearing in their own native tongue. That is exactly what .NET does for programming languages.

The Future is Faster

Let's take a step back and look at how we build applications today. When we compile our source code, the compiler emits assembly code for a specific type of CPU. For Win32, this might be for a 486 CPU. On a 486, the code runs a full potential. However, very few people today are running with 486 computers, and in fact, are using CPUs many versions newer. But since you cannot predict what your users will use, you must compile for the lowest possible factor. This also severely restricts Intel, AMD, and other CPU manufacturers, as backwards compatibility must be maintained for many generations.
With .NET code, your source code is compiled into IL. This IL is then executed on any CPU or operating system with the .NET framework. This IL is not just interpreted though, it is essentially compiled on demand using instruction sets optimized for the platform. This on-demand compiler can be easily updated in the future to support newer CPUs and even incompatible instruction sets. Each individual user then will run their own optimized version of your software, for their hardware. All without needing to ever recompile your code or redistribute your application to users.
Moving from the 16 bit world to the 32 bit world was quite painful for developers. It was not just a simple recompile of the code as many underlying support architectures changed. But with .NET, you can move into the 64 bit world and take advantage of the faster processing power without recompiling, redesigning, or even redistributing your software. That is what I call upgrade insurance!
While C++ can be compiled for many platforms, this requires each build to be built for each and every platform. This is a very maintenance intensive task, and expensive in many cases as well. Cross platform C++ code has a lot more restrictions, and often code does not compile well across platforms, while .NET code is always cross platform. The key factor though is that, in C++, for future platforms, you must recompile as compilers become available, while .NET code needs no changes or recompilation.

Future Exception
.NET 1.1 applications built with Visual Studio 2003 may not automatically take advantage of 64 bit CPUs. Because many developers are still writing unsafe code and relying on CPU word sizes, Visual Studio currently marks its IL output with a 32 bit flag. This will cause 64 bit .NET to execute these assemblies in 32 bit compatibility mode. This will take advantage of some of the 64 bit CPU, but not all.
If your code is safe and free of “bitness”, you can override this flag and your assembly should then run in 64 bit mode. The next version of Visual Studio which supports .NET 2.0 is planned to emit a platform neutral flag. Other .NET 1.1 languages may not have the conservative value that Visual Studio uses, and thus can take advantage of 64 bit with no changes.
While this limitation certainly is not pleasing, it is not a limitation of the .NET framework, but instead a design choice of Visual Studio.

Improved VB
Visual Basic over the years has had several "bad" features added to it which allowed and even encouraged bad programming practices. This has given Visual Basic a bad name in many circles.
.NET has forced VB back into the realm of proper development practices and will keep its designers from reverting it. This article is not a tirade on VB either, but for those of you who need a reminder, I have 2 words for you: Option Implicit. This option is bad enough, but it's the default for projects. VB has many other such faults that .NET has forced to be fixed. VB.NET still has this option for backwards compatibility, but the default has been changed. Many other items have been eliminated completely.

Modernized C++
I realize that this next topic will put me into hot water with C++ developers. But ..... C++ is a fantastic low level language - and that is exactly what it is designed for. But C++ because it is so suited to such, is not as well suited as an application language. Its insistent use of pointers for the simplest of tasks inherently makes it "unsafe" by the .NET definition.
Thus, we have C#. C# is a .NET conforming language based on C++. C# finally forces C++ programmers to give up old habits and move to safe programming practices.
Where does this leave C++? C++ is still the language of choice for writing unmanaged assemblies for direct hardware access, high performance number crunching, compression, and encryption. So, C++ stalwarts need not worry – C++ will be around for the foreseeable future. But your ranks will shrink as many of your fellow developers move partly or completely to C#.
For application, server, business, and general development, C++ developers should look to C#. While you lose many of the low level items you have grown to love in C++, C# is a language with a syntax based on C++, but built for .NET. It will irritate you at first, but you will grow to love it and you will not look back.
Pointers are fondly admired by C++ developers, but so were line numbers by Basic programmers. I certainly do not mean to compare modern C++ developers to Basic programmers, but the fundamental shift is the same. Once you move, you will not miss what you have lost and will be better off for it.

Fewer Crashes
Code that runs on a .NET platform is less likely to crash, and it is virtually impossible for managed code to take down the system or affect other applications.
This is due to two factors:
.NET restricts what applications can do, what they can access, and how they manage memory.
.NET forces developers to use modern languages with modern programming practices. .NET forces developers to abandon old habits and techniques designed for computer systems of the 1970's era.
C++ developers are also quick to reply that “Modern C++ has warnings for X and Y, or compiler option Z can prevent that.”. The problem with warnings is that C++ issues so many warnings, and C++ developers often want to override them anyways that on each compile, a C++ program issues hundreds if not thousands of such warnings. Finding the important ones is not a quick or easy task. Compiler options are problematic too. Since C++ developers are typically speed freaks, nearly all such safeguards are turned off in releases, no matter if the code runs sufficiently fast or not. Since release code is used by a much larger user audience, the releases encounter situations never encountered in the debug releases and simply crash. .NET forces these checks to always be on, providing for better applications by properly handling exceptions instead of merely corrupting memory or other.

Debunking Myths
.NET has invoked fear in the minds of many developers. Some of the fears are based on facts but surrounded by misunderstandings, while others are based on pure misinformation, and in some cases, even religious beliefs. Let's examine a few of the more common ones with a logical approach.
.NET has a Big Runtime.
.NET has a 20 megabyte runtime. That's too big for a normal application.
First of all it is not a run time library. The .NET framework is a complete platform similar to how Win32, DOS, Unix, and Java are platforms. Currently, .NET runs on top of Windows and thus must be installed.
The install for the 1.1 version of the .NET framework is approximately 20 megabytes. However, the Windows XP Service Pack 1 CDs include this runtime as part of their installation, and many users already have the framework installed. In the future, the .NET framework will gain wider and wider acceptance just as other Microsoft components have such as DirectX, etc. Most games rely on DirectX installation and install it without trouble or complaints of a run time.
Future versions of the Windows operating system will ship with the .NET framework installed as part of the native operating system.
20 megabytes is also not a very large distribution in the scheme of things. Most software are several megabytes or even larger. The .NET runtime only needs to be installed by those users who do not already have it, and thus is optional. Adding a 20 megabyte install to a CD distribution and installing if needed will not negatively impact deployment.
20 megabytes is more measurable in the world of electronic downloads. However, electronic downloads over the Internet are normally performed by technical savvy users who likely already have the framework installed, or have a DSL or better Internet connection.
The 20 megabytes also refers to the complete framework. When your application loads, it will not link to a 20 megabyte runtime that loads into memory, just as a standard Win32 application today does not load 200 megabytes of Windows support for each run.

.NET is Slow.
Some .NET applications do in fact run slower. Compression and encryption routines are one example that often run slower. Such functions should be written using unmanaged code anyways because of the security implications and need to directly manipulate structures in specific ways that encryption requires.
However, such applications occupy a very small minority of the average development need. Most developers are developing either server side objects, or desktop applications. Such tasks when written properly will execute just as fast in Win32, or faster.
Faster? Yes faster. This is because the .NET framework implements and provides so many more services than what a Win32 application has available to it, and also because of how IL code is actually optimized and executed.
But I ported my application and it's 100 times slower!
That's a very common scenario. Many applications when ported do run 100 times or more slower than the original Win32 application. But I said they should run faster, right? So, how is this that so many applications run slower after porting?
The answer is simple - the applications were ported, but the design remained the same. That is, a straight port was performed without using the new techniques in development.
It's certainly possible to take a large engine from a 1960's hot rod and put it into a modern car and make it run. However, powering it on unleaded fuel, and integrating it in with the car system and bodies designed 40 years later will not yield the expected results. When porting to .NET, you need to take into account that it works differently in several key areas.
Do you have to redesign your application from the ground up? No. But you should look at some key areas and consider altering them to operate under the new paradigms so that they will run properly, and efficiently.
Loss of Control.
Many developers have become very accustomed to having full control. This habit is especially true for C++ developers. Developing for .NET control is diminished if your definition of control is direct access to memory. In most object oriented languages, developers have been moving more and more away from direct memory access, and towards managed memory and object interfaces. .NET takes this to the next level and only allows managed memory and objects.
While at first, this may grate developers because they may need to change long established habits, the change is a good and even necessary one.
The Future of .NET
Even if you do not plan to move to .NET now, you will in the future. Developers and companies who resist the move to .NET in the future will be like developers writing Windows 3.1 or DOS applications today. .NET is coming - while you may not move to it now, the sooner you come to terms with the fact that you will move someday, the better.

Mono
Mono is a .NET implementation for Linux that allows managed .NET code to execute on Linux. Mono is exciting because it demonstrates that while Microsoft is the motivating force behind .NET, .NET itself can and will be available on other operating systems.

Mainframes
In the future, I expect that the .NET framework will be available on mainframe class computers. For enterprises with big investment in mainframes, this will be a big step. As demonstrated with Mono, this is something that is certainly possible, and is just a matter of time.

Servers
In the future, as .NET is available on more operating systems, servers will be available to run server based assemblies. Operating system and even CPU will no longer matter, and any server which has support for the .NET framework will be able to run assemblies written by developers using any other operating system.

Windows
Windows currently is based on the Win32 core. And the .NET framework runs on top of the Win32 core. However, in future editions of Windows, this relationship will blur and eventually reverse. This is very similar to how Windows 3.1 evolved into Win32.
In the future, Microsoft will ship an operating system that *is* .NET. Drivers and trusted code will still be permitted to run at a high level to provide hardware and other necessary support. However, unmanaged applications will run in a compatibility environment which simulates the Win32 API and translates to the .NET framework. This is similar to how Windows 3.1 applications are run on Win32.
The ultimate goal for every application is to become a managed application. While this may seem very far fetched, if we look back at history, it is not. In the days of Windows 3.1 or even DOS, it seemed a far dream to have all Win32 applications. However today, very few users are still using Win3.1 or true DOS applications (not to be confused with Win32 console applications). And it's very rare to find any developer still developing code for such environments.

Summary
It's hard to summarize this whole article. The article itself was a summary. So instead, let's consider some comparisons.
Win32 code is like a 1950's corvette. All soaped up and a lot of raw horsepower. You can go in and monkey with the engine and make easy modifications. You can pop it out of gear. You can shift into first gear while doing 100 miles per hour, if you want.
.NET is a 2004 corvette. Still lots of horsepower, but now you have seat belts, computer controlled engine, airbags, anti lock brakes, and safety glass.
As an antique, the 1950's corvette certainly has some appeal. But in developing software, not many of us fondly look back at punch cards or DOS windows. So, that leaves safety and capability. Cars certainly do not crash as often as software does. If they did, the human race would be in a steep population decline. So, let's assume that cars did crash just as often and that frequent and even serious crashes were common. Which car would you prefer to drive?