Monday, July 14, 2008

What is the difference between a.Equals(b) and a == b?

The Equals method is just a virtual one defined in System.Object, and overridden by whichever classes choose to do so. The == operator is an operator which can be overloaded by classes, but which usually has identity behaviour.

For reference types where == has not been overloaded, it compares whether two references refer to the same object - which is exactly what the implementation of Equals does in System.Object.

Value types do not provide an overload for == by default. However, most of the value types provided by the framework provide their own overload. The default implementation of Equals for a value type is provided by ValueType, and uses reflection to make the comparison, which makes it significantly slower than a type-specific implementation normally would be. This implementation also calls Equals on pairs of references within the two values being compared.

However, the main difference between the two types of comparison in normal use (where you're unlikely to be defining your own value types very often) is polymorphism. Operators are overloaded, not overridden, which means that unless the compiler knows to call the more specific version, it'll just call the identity version.

To illustrate that, here's an example:

using System;

public class Test

{

static void Main()

{

// Create two equal but distinct strings

string a = new string(new char[] {'h', 'e', 'l', 'l', 'o'});

string b = new string(new char[] {'h', 'e', 'l', 'l', 'o'});

Console.WriteLine (a==b);

Console.WriteLine (a.Equals(b));

// Now let's see what happens with the same tests but

// with variables of type object

object c = a;

object d = b;

Console.WriteLine (c==d);

Console.WriteLine (c.Equals(d));

}

}

The results are:

True

True

False

True

The third line is False because the compiler can only call the non-overloaded version of = as it doesn't know that the contents of c and d are both string references. As they are references to different strings, the identity operator returns false.

So, when should you use which operator? for almost all reference types, use Equals when you want to test equality rather than reference identity. The exception is for strings - comparing strings with == does make things an awful lot simpler and more readable but you need to remember that both sides of the operator must be expressions of type string in order to get the comparison to work properly.

For value types, I'd normally use == for easier-to-read code. Things would get tricky if a value type provided an overload for == which acted differently to Equals, but I'd consider such a type very badly designed to start with.

What is strong-typing versus weak-typing? Which is preferred? Why?

In strongly-typed programming languages you usually have to declare variables prior to using them. Strong-typing is the strict enforcement of [type] rules. All types (int, short, long, string) are know at compile time and are statically bound. So C# is a strongly-typed language because variables must be assigned a type before you use them. If you came from the ASP world then you will remember having to use either Javascript or VBScript. Variables that you declare in either of those languages can hold any data type which makes it weakly-typed.

But lets take this up a level. Instead to talking about programming languages, lets talk about strongly-typed/weakly-typed objects. The DataSet object is a great example. If we use a weakly-typed dataset, the developer needs to know the name of the table and the name of the field being requested.

Since we are just passing strings, this code will compile and will not show any possible problems (like typing the name of the table wrong) until run time.

string s = (string) myDataSet.Tables["Customers"].Rows[0]["CustomerID"];


If our Dataset is Strongly-Typed, we are able to access the names of the tables and columns directly. Any errors are caught at compile time.

string s = myDataSet.Customers[0].CustomerID;

In simple manner we can say Strong type is checking the types of variables as soon as possible, usually at compile time. While weak typing is delaying checking the types of the system as late as possible, usually to run-time. Which is preferred depends on what you want. For scripts & quick stuff you’ll usually want weak typing, because you want to write as much less (is this a correct way to use Ensligh?) code as possible. In big programs, strong typing can reduce errors at compile time.

ref: http://www.dotnetdoc.com/PermaLink,guid,941038f1-f683-4caf-a425-e653c1968a15.aspx

What is the difference between an EXE and a DLL?

DLL - Dynamic Link Library

An ActiveX Dll runs is an in process server running in the same memory space as the client process.

EXE – Executable File

An ActiveX Exe is an out of process server which runs in its own separate memory space.

Advantages of ActiveX Dll-

1) An in-process component shares its client’s address space, so property and method calls don’t have to be marshaled. This results in much faster performance.

Disadvantages of ActiveX Dll-

1) If an unhandled error occurs it will cause the client process to stop operating.

Advantages of ActiveX Exe-

1) The component can run as a standalone desktop application, like Microsoft Excel or Microsoft Word, in addition to providing objects.

2) The component can process requests on an independent thread of execution, notifying the client of task completion using events or asynchronous call-backs. This frees the client to respond to the user.

3) If an error occurs the client processes can continue to operate.

Disadvantages of ActiveX Exe-

1) Generally slower than an ActiveX dll alternative

ref: http://forums.msdn.microsoft.com/en/csharpgeneral/thread/24c60557-4718-4a9f-bf87-a7d122cc7455/

Describe the difference between a Thread and a Process?

PROCESS
A process will execute the threads(set of instructions), which may contain multiple threads sometimes.
THREAD
It contains a group of instructions that a processor has to do.

Process is a execution of a program and program contain set of instructions but thread is a single sequence stream within the process.thread is sometime called lightweight process. single thread alows a os to perform singler task ata time similarities between process and threads are:
1) share cpu.
2) sequential execution
3) create child
4) if one thread is blocked then the next will be start to run like process.

dissimilarities:
1) threads are not independent like process.
2) all threads can access every address in the task unlike process.
3) threads are design to assist onr another and process might or not might be assisted on one another.

ref: http://wiki.answers.com

Tuesday, July 8, 2008

What is Manifest?

Assembly metadata is stored in Manifest. Manifest contains all the metadata needed to do the following things.

  • Version of assembly
  • Security identity
  • Scope of the assembly
  • Resolve references to resources and classes

The assembly manifest can be stored in either a PE file (an .exe or .dll) with Microsoft intermediate language (MSIL) code or in a stand-alone PE file that contains only assembly manifest information.

What are the Access Modifiers in C#.NET?

C# has 5 Access Modifiers :

1.Public: The item is visible to any other code.
2.Private: The item is visible only inside the type to which it belongs.
3.Protected: The item is visible only to any derived type
4.Internal: The item is visible only within its containing assembly.
5.Protected Internal: The item is visible to any code within its containing assembly and also to any code inside a derived type

What is a WebService?

Web services are a new way of performing remote method calls over HTTP that can make use of Simple Object Access Protocol (SOAP). In the past this issue has been fraught with difficulty, as anyone who has any DCOM (Distributed COM) experience knows. The act of instantiating an object on a remote server, calling a method, and obtaining the result was far from simple, and the necessary configuration was even trickier.

ref: http://www.aspdotnetfaqs.com/

Explain about Generics?

Generics are not a completely new construct; similar concepts exist with other languages. For example, C++ templates can be compared to generics. However, there's a big difference between C++ templates and .NET generics. With C++ templates the source code of the template is required when a template is instantiated with a specific type. Contrary to C++ templates, generics are not only a construct of the C# language; generics are defined with the CLR. This makes it possible to instantiate generics with a specific type in Visual Basic even though the generic class was defined with C#.

ref: http://www.aspdotnetfaqs.com/

What is a Static Class?

A static class is functionally the same as creating a class with a private static constructor. An instance of the class can never be created. By using the static keyword, the compiler can help by checking that instance members are never accidentally added to the class.

ref: http://www.aspdotnetfaqs.com/

What is Partial Class?

The partial keyword allows the class, struct, or interface to span across multiple files. Typically a class will reside entirely in a single file. However, in situations where multiple developers need access to the same class, or more likely in the situation where a code generator of some type is generating part of a class, then having the class in multiple files can be beneficial.


ref: http://www.aspdotnetfaqs.com/

Wednesday, July 2, 2008

What is different between WebUserControl and in WebCustomControl ?

Web user controls :- Web User Control is Easier to create and another thing is that its support is limited for users who use a visual design tool one gud thing is that its contains static layout one more thing a seprate copy is required for each application.
Web custom controls:-Web Custom Control is typical to create and gud for dynamic layout and another thing is it have full tool support for user and a single copy of control is required because it is placed in Global Assembly cache.

What is main difference between GridLayout and FormLayout ?

GridLayout helps in providing absolute positioning of every control placed on the page.It is easier to devlop page with absolute positioning because control can be placed any where according to our requirement.But FormLayout is little different only experience Web Devloper used this one reason is it is helpful for wider range browser.If there is absolute positioning we can notice that there are number of DIV tags. But in FormLayout whole work are done through the tables.

What is the purpose of IIS ?

We can call IIS(Internet Information Services) a powerful Web server that helps us creating highly reliable, scalable and manageable infrastructure for Web application which runs on Windows Server 2003. IIS helps development center and increase Web site and application availability while lowering system administration costs. It also runs on Windows NT/2000 platforms and also for above versions. With IIS, Microsoft includes a set of programs for building and administering Web sites, a search engine, and support for writing Web-based applications that access database. IIS also called http server since it process the http request and gets http response.

What is WebPortal ?

Web portal is nothing but a page that allows a user to customize his/her homepage. We can use Widgets to create that portal we have only to drag and drop widgets on the page. The user can set his Widgets on any where on the page where he has to get them. Widgets are nothing but a page area that helps particular function to response. Widgets example are address books, contact lists, RSS feeds, clocks, calendars, play lists, stock tickers, weather reports, traffic reports, dictionaries, games and another such beautiful things that we can not imagine. We can also say Web Parts in Share Point Portal. These are one of Ajax-Powered.

What is cross page posting in ASP.NET2.0 ?

When we have to post data from one page to another in application we used server.transfer method but in this the URL remains the same but in cross page posting there is little different there is normal post back is done but in target page we can access values of server control in the source page.This is quite simple we have to only set the PostBackUrl property of Button,LinkButton or imagebutton which specifies the target page.In target page we can access the PreviousPage property.And we have to use the @PreviousPageType directive.We can access control of PreviousPage by using the findcontrol method.When we set the PostBackURL property ASP.NET framework bind the HTML and Javascript function automatically.

What do you mean by Share Point Portal ?

Here I have taken information regarding Share Point Portal Server 2003 provides mainly access to the crucial business information and applications.With the help of Share Point Server we can server information between Public Folders, Data Bases, File Servers and the websites that are based on Windows server 2003. This Share Point Portal is integrated with MSAccess and Windows servers,So we can get a Wide range of document management functionality. We can also create a full featured portal with readymade navigation and structure.

Explain virtual function in c# with an example.

Virtual functions implement the concept of polymorphism are the same as in C#, except that you use the override keyword with the virtual function implementaion in the child class. The parent class uses the same virtual keyword. Every class that overrides the virtual method will use the override keyword.
class Shape
{
public virtual void Draw()
{
Console.WriteLine("Shape.Draw") ;
}
}
class Rectangle : Shape
{
public override void Draw()
{
Console.WriteLine("Rectangle.Draw");
}
}

Tuesday, July 1, 2008

What is C#?

C# is an object-oriented programming language developed by Microsoft as part of the .NET initiative and later approved as a standard by ECMA (ECMA-334) and ISO (ISO/IEC 23270). Anders Hejlsberg leads development of the C# language, which has a procedural, object-oriented syntax based on C++ and includes influences from aspects of several other programming languages (most notably Delphi and Java) with a particular emphasis on simplification.

What is Asp.net?

Definitions of ASP.NET on the Web:

ASP.NET is A set of web development technologies that enable programmers to build web applications and XML web services.www.proace.com/definitions.aspx This is the latest incarnation of Microsoft's middleware for the Internet. ASP.NET is built upon the .NET Framework. The . ...www.cylogy.com/library/glossary.html The next generation of the ASP web scripting language. It provides a complete environment for content management and sharing over the Internet.www.harvestseo.com/seo-glossary-a.html http://en.wikipedia.org/wiki/ASP.NETwww.123exp-computing.com/t/03974258935/ A Web server technology for dynamically rendering HTML pages using a combination of HTML, Javascript, CSS, and server-side logic.msdn.microsoft.com/en-us/library/cc224030.aspx A web application framework used to build websites, more detailswww.diazthetechexpert.com/dictionary/ ASP.NET is a web application framework marketed by Microsoft that programmers can use to build dynamic web sites, web applications and web ...en.wikipedia.org/wiki/ASP.NET



What is ASP.NET?
ASP.NET combines unprecedented developer productivity with performance, reliability, and deployment.
Developer ProductivityASP.NET helps you deliver real world Web applications in record time.
Easy Programming Model. ASP.NET makes building real world Web applications dramatically easier. ASP.NET server controls enable an HTML-like style of declarative programming that let you build great pages with far less code than with classic ASP. Displaying data, validating user input, and uploading files are all amazingly easy. Best of all, ASP.NET pages work in all browsers -- including Netscape, Opera, AOL, and Internet Explorer.
Flexible Language Options . ASP.NET lets you leverage your current programming language skills. Unlike classic ASP, which supports only interpreted VBScript and JScript, ASP.NET now supports more than 25 .NET languages (including built-in support for VB.NET, C#, and JScript.NET -- no tool required), giving you unprecedented flexibility in your choice of language.
Great Tool Support. You can harness the full power of ASP.NET using any text editor -- even Notepad! But Visual Studio 2005 adds the productivity of Visual Basic-style development to the Web. Now you can visually design ASP.NET Web Forms using familiar drag-drop-doubleclick techniques, and enjoy full-fledged code support including statement completion and color-coding. VS.NET also provides integrated support for debugging and deploying ASP.NET Web applications.
The Professional version of Visual Studio 2005 deliver life-cycle features to help organizations plan, analyze, design, build, test, and coordinate teams that develop ASP.NET Web applications. These include UML class modeling, database modeling (conceptual, logical, and physical models), testing tools (functional, performance and scalability), and enterprise frameworks and templates, all available within the integrated Visual Studio .NET environment.
Rich Class Framework. Application features that used to be hard to implement, or required a 3rd-party component, can now be added in just a few lines of code using the .NET Framework. The .NET Framework offers over 4500 classes that encapsulate rich functionality like XML, data access, file upload, regular expressions, image generation, performance monitoring and logging, transactions, message queuing, SMTP mail, and much more!

Improved Performance and ScalabilityASP.NET lets you use serve more users with the same hardware.
Compiled execution. ASP.NET is much faster than classic ASP, while preserving the "just hit save" update model of ASP. However, no explicit compile step is required! ASP.NET will automatically detect any changes, dynamically compile the files if needed, and store the compiled results to reuse for subsequent requests. Dynamic compilation ensures that your application is always up to date, and compiled execution makes it fast. Most applications migrated from classic ASP see a 3x to 5x increase in pages served.
Rich output caching. ASP.NET output caching can dramatically improve the performance and scalability of your application. When output caching is enabled on a page, ASP.NET executes the page just once, and saves the result in memory in addition to sending it to the user. When another user requests the same page, ASP.NET serves the cached result from memory without re-executing the page. Output caching is configurable, and can be used to cache individual regions or an entire page. Output caching can dramatically improve the performance of data-driven pages by eliminating the need to query the database on every request.
Web-Farm Session State. ASP.NET session state lets you share session data user-specific state values across all machines in your Web farm. Now a user can hit different servers in the web farm over multiple requests and still have full access to her session. And since business components created with the .NET Framework are free-threaded, you no longer need to worry about thread affinity.
Microsoft .NET Outperforms J2EE. In a head-to-head comparison of performance and scalability between Sun's Java Pet Store J2EE blueprint application and the ASP.NET implementation, Microsoft .NET significantly outperformed J2EE. The bottom line: the ASP.NET implementation required only 1/4th as many lines of code, was 28x faster (that's 2700%), and supported 7.6x as many concurrent users as J2EE, with only 1/6th as much processor utilization. Click here to review the results, download the code, and run the .NET Pet Shop yourself.
Enhanced ReliabilityASP.NET ensures that your application is always available to your users.
Memory Leak, DeadLock and Crash Protection. ASP.NET automatically detects and recovers from errors like deadlocks and memory leaks to ensure your application is always available to your users. For example, say that your application has a small memory leak, and that after a week the leak has tied up a significant percentage of your server's virtual memory. ASP.NET will detect this condition, automatically start up another copy of the ASP.NET worker process, and direct all new requests to the new process. Once the old process has finished processing its pending requests, it is gracefully disposed and the leaked memory is released. Automatically, without administrator intervention or any interruption of service, ASP.NET has recovered from the error.
Easy DeploymentASP.NET takes the pain out of deploying server applications.
"No touch" application deployment. ASP.NET dramatically simplifies installation of your application. With ASP.NET, you can deploy an entire application as easily as an HTML page: just copy it to the server. No need to run regsvr32 to register any components, and configuration settings are stored in an XML file within the application.
Dynamic update of running application. ASP.NET now lets you update compiled components without restarting the web server. In the past with classic COM components, the developer would have to restart the web server each time he deployed an update. With ASP.NET, you simply copy the component over the existing DLL -- ASP.NET will automatically detect the change and start using the new code.
Easy Migration Path. You don't have to migrate your existing applications to start using ASP.NET. ASP.NET runs on IIS side-by-side with classic ASP on Windows 2000 and Windows XP platforms. Your existing ASP applications continue to be processed by ASP.DLL, while new ASP.NET pages are processed by the new ASP.NET engine. You can migrate application by application, or single pages. And ASP.NET even lets you continue to use your existing classic COM business components.
New Application ModelsASP.NET extend your application's reach to new customers and partners.
XML Web Services. XML Web services allow applications to communicate and share data over the Internet, regardless of operating system or programming language. ASP.NET makes exposing and calling XML Web Services simple. Any class can be converted into an XML Web Service with just a few lines of code, and can be called by any SOAP client. Likewise, ASP.NET makes it incredibly easy to call XML Web Services from your application. No knowledge of networking, XML, or SOAP is required.
Mobile Web Device Support. ASP.NET Mobile Controls let you easily target cell phones, PDAs -- over 80 mobile Web devices -- using ASP.NET. You write your application just once, and the mobile controls automatically generate WAP/WML, HTML, or iMode as required by the requesting device.

Ref: http://msdn.microsoft.com/en-us/asp.net/aa336565.aspx

Microsoft Dot Net Lovers

This blog is dedicated for the new Microsoft Asp.net programmers. you can find details of different type of controls, thier sample code and learn how to use them. In this blog you can also find links to the different website who cotains the text of your reference. Here programer/ student can post thier problems and we will try to provide solutions.

This is a small step towords providing information the new Asp.net programmers who are using C#.net or VB.net. This blog will help them to be good programmer.

I would request all smart and good progrmmers to post thier code for different controls, solotions for the common problems and help them who have posted thier problems. This blog will be good the plateform for experts also to enhance thier and check thier knowledge.