tutorials, tips and tricks to design a Windows Phone,Windows Store ,UWP,XAML ,.Net Application , Micrsoft Interview Question
Wednesday, August 24, 2011
Beginner Delegate program
C# Dotnet Delegate
What is Delegate?
· Its reference to method.
· once method assign to delegate its work like method
· delegate method used any other method
Where we will use real time?
If you want to call Function in Runtime .and to get data after you can call your function but method name you don't know design time but you know runtime during time you can use "Delegate"
Different type of Delegate:
- Single cast Delegate
- Multicast Delegate
Single cast Delegate Syntax:
Below are signature of single cast delegate
Access-modifier delegate result-type identifier ([parameters]);
Access-modifier è Its Access permission for delegate (like public ,private ..,)
Delegate è it's a Keyword
Result-type èthis is return type (like int,string,void)
Identifier è delegate name (user define)
Parameter è run time value passing
Ex :
Way 1:
public delegate void jsdelegate();
above example is no return type ,no parameter
Way 2:
public delegate string jsdelegatevalue(int x,int y);
above example is string is return type and x,y is parameter
above 2 way are delegate declaration
What is Advantage in VS 2010 Editor?
What is Advantage in VS 2010 Editor?
· There is now support for multiple monitors and the ability to drag windows outside the IDE
· IntelliSense is now two to five times quicker than previous versions.
- Readability of text is improved.
- Add reference is previously very slow .now is very fast
- Intelligence now support partial string matching if you are type SB it will match string StringBuilder also
Example
Tuesday, August 23, 2011
WCF Programming Model
Disadvatage:
- Disadvantage is that only HTTP protocol could be used.
- Another disadvantage is all the service will run on the same port.
WCF Programming Model:
WCF service have three parts .Service,End Point,Hosting
Service it is a class written in a .net language which have some method.service have one or more endpoint
Endpoint means communicate with client.end point have 3 parts 'ABC':
· 'A' for Address,
· 'B' for Binding
· 'C' for Contracts.
Address(WHERE): Address specifies the info about where to find the service.
Binding(HOW): Binding specifies the info for how to interact with the service.
Contracts(What): Contracts specifies the info for how the service is implemented and what it offers.
Monday, August 22, 2011
What is WCF ?
WCF
· Windows Communication Foundation is a programming platform and runtime system for building, configuring and deploying network-distributed services.
· It is the latest service oriented technology.
· WCF is a combined features of Web Service, Remoting, MSMQ and COM
WCF Advantaged:
- WCF is interoperable with other services when compared to .Net Remoting,where the client and service have to be .Net.
- WCF services provide better reliability and security in compared to ASMX web services.
- In WCF, there is no need to make much change in code for implementing the security model and changing the binding. Small changes in the configuration will make your requirements.
- WCF has integrated logging mechanism, changing the configuration file settings will provide this functionality.
5. WCF services can be debugged now in Visual Studio 2008 /2010. Wcfsvchost.exe will do it for you because service will be self hosted when you start debugging.
WCF vs WebService:
Wcf and Webservice have some difference
| Features | Web Service | WCF |
| Hosting | It can be hosted in IIS | It can be hosted in IIS, windows activation service, Self-hosting, Windows service |
| Programming | [WebService] attribute has to be added to the class | [ServiceContraact] attribute has to be added to the class |
| Model | [WebMethod] attribute represents the method exposed to client | [OperationContract] attribute represents the method exposed to client |
| Operation | One-way, Request- Response are the different operations supported in web service | One-Way, Request-Response, Duplex are different type of operations supported in WCF |
| XML | System.Xml.serialization name space is used for serialization | System.Runtime.Serialization namespace is used for serialization |
| Encoding | XML 1.0, MTOM(Message Transmission Optimization Mechanism), DIME, Custom | XML 1.0, MTOM, Binary, Custom |
| Transports | Can be accessed through HTTP, TCP, Custom | Can be accessed through HTTP, TCP, Named pipes, MSMQ,P2P, Custom |
| Protocols | Security | Security, Reliable messaging, Transactions |
Friday, June 24, 2011
Abstract Class in c#.net
Reserve word in C#.net
private void btn_Click(object sender, EventArgs e)
{
string string="Welocme to DevEnvExe"
}
Suppose if you want use above coding
private void btn_Click(object sender, EventArgs e)
{
string @string="Welocme to DevEnvExe"
}
Below list are C#.net reserve words
unchecked
unsafe
ushort
boolirtual
class
abstract
as
base
byte
char
decimal
int
sbyte
uint
ulong
break
case
catch
finally
checked
const
continue
default
delegate
do
double
else
enum
event
explicit
extern
false
fixed
float
for
foreach
goto
if
implicit
in
interface
internal
is
lock
long
namespace
new
null
object
operator
out
override
params
private
protected
public
readonly
ref
return
sealed
short
sizeof
stackalloc
static
string
struct
switch
while
this
throw
true
try
typeof
using
void
volatile
|

