Sunday, October 31, 2010

C# concepts

1.     Explain about Protected and protected internal, “internal” access-specifier?
protected – Access is limited to the containing class or types derived from the containing class.
internal – Access is limited to the current assembly.
protected internal – Access is limited to the current assembly or types derived from the containing class.
 
2.     Difference between type constructor and instance constructor? What is static constructor, when it will be fired? And what is its use?
(Class constructor method is also known as type constructor or type initializer)
Instance constructor is executed when a new instance of type is created and the class constructor is executed after the type is loaded and before any one of the type members is accessed. (It will get executed only 1st time, when we call any static methods/fields in the same class.) Class constructors are used for static field initialization. Only one class constructor per type is permitted, and it cannot use the vararg (variable argument) calling convention.
A static constructor is used to initialize a class. It is called automatically to initialize the class before the first instance is created or any static members are referenced.
3.     What is Private Constructor? and it’s use? Can you create instance of a class which has Private Constructor?
A: When a class declares only private instance constructors, it is not possible for classes outside the program to derive from the class or to directly create instances of it. (Except Nested classes)
Make a constructor private if:
- You want it to be available only to the class itself. For example, you might have a special constructor used only in the implementation of your class’ Clone method.
- You do not want instances of your component to be created. For example, you may have a class containing nothing but Shared utility functions, and no instance data. Creating instances of the class would waste memory.
4.     I have 3 overloaded constructors in my class. In order to avoid making instance of the class do I need to make all constructors to private?
(yes)
5.     Overloaded constructor will call default constructor internally?
(no)


Friday, October 29, 2010

Diffeence between WCF service and Web service

WEB SERVICE: extention shoud be .asmx
WCF: extention of this is .svc

WEB SERVICE: is not secured by default.. we have to provide security manually by writing code
WCF: is secured by default

WEB SERVICE: supports only http protocol
WCF: supports all protocols( http, tcp, msmq....)

WEB SERVICE: in this class shoud be written as [WEB SERVICE]
WCF: in this class shoud be written as [SERVICE CONTRACT]

WEB SERVICE: in this all retun types are not serializable( like DataTable, HashTable)
WCF: all types are serializable

WCF BASICS

WINDOWS COMMUNICATION FOUNDATION
1.INTRODUCTION
The aim of this article is to explain the basics of WCF in a manner as simple as possible.It is assumed that the reader doesn’t know anything about WCF or .NET 3.0, however he/she is expected to know .NET 2.0 and/or simple facts like what is a web service.While writing this article (or for any other) I always try to avoid difficult technical words, which may confuse the reader. I have tried to put it in as simple words as possible.At the end of this article, I would hope you understand at least some of the key WCF areas and possibly be inspired enough to try out a project on your own.



2.FUNDA OF WCF

Key Concepts:
a) What is WCF?
WCF stands for Windows Communication Foundation.
WCF is advanced API (Application Programming Interface) for creating distributed applications using .NET framework.
It is introduced in .NET 3.0.
Distributed system in its simplest form is two executable running and exchanging data.
WCF API is found in System.ServiceModel namespace.
WCF is based on basic concepts of Service oriented architecture (SOA)

b) What is a WCF Service?
         A WCF service is a program that exposes a collection of Endpoints (connections) for communicating with either client applications or other service applications.
       
c) What are the components of WCF application?
                          There are three main components of a WCF application
i)      a WCF service
ii)     a WCF service host
iii)     a WCF service client
         d) What is the “ABC” of a WCF Service?
“ABC” of WCF stands for addresses Bindings and contracts respectively.
                i) Addresses:   This is location of the service in the form of an
                URI (Uniform resource Identifier) generally mentioned
                In the config file.

                ii) Bindings: This includes the type of network protocol  used by the
                Service. For Example HTTP, TCP/IP or others.
               
                iii) Contracts:  This is in fact the methods exposed by the WCF service.

e) What is a Service Contract in WCF application?
Service contract is the name of the attribute which is applied to an interface in   a WCF service.


f) What is an Operation Contract in WCF application?
Operation contract is the name of the attribute which is applied to a   method inside the interface of a WCF service

Thursday, October 28, 2010

Difference between WPF and Silverlight

Silverlight can run in any browser... where as WPF can run only on IE.

DOTNET with WCF and Silverlight

hiiii.... Develop any application in ASP.net ang give user interface using SILVERLIGHT...
If u develop Desktop applications then give user interface using WPF... then its look very very rich...