Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Wednesday, August 24, 2011

Beginner Delegate program

Add Two Number Delegate Program 

 public delegate int AddTwoNumberDel(int fvalue, int svalue);

        private void btnClick_Click(object sender, EventArgs e)
        {
            AddTwoNumberDel AT = Addnumber;                   // create delegate instance
           //is shorthand for

            //AddTwoNumberDel AT = new AddTwoNumberDel(Addnumber);

           
            int a = Convert.ToInt16(txtfvalue.Text);
            int b = Convert.ToInt16(txtsvalue.Text);
            txtresult.Text = AT(a, b).ToString();          // invoke Method
            //is shorthand for
            //txtresult.Text = AT.Invoke(a, b).ToString();
        }


        public int Addnumber(int fvalue, int svalue)
        {

            return fvalue + svalue;

        }
Note:
Copy and past your VS Editor it will Work... Do you want sample application mail me ...

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

ExampleJSVS2010.png

Tuesday, August 23, 2011

WCF Programming Model

Disadvatage:

  1. Disadvantage is that only HTTP protocol could be used.
  2. 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:

  1. WCF is interoperable with other services when compared to .Net Remoting,where the client and service have to be .Net.
  2. WCF services provide better reliability and security in compared to ASMX web services.
  3. 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.
  4. 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

Abstract Class:
Now we will discuss about abstract class in c#.net.
·         Abstract class is class we cannot create object. We only use inherit
·         We are only use base class. If u r use abstract method u must implement derived class
Abstract Class Declaration
abstract class devenvexe
{
}
A abstract class can contain  abstract method or non-abstract method .abstract method not have implementation in abstract class .but same its have derived class
Abstract Method/Non Abstract Method:
abstract class devenvexe
{ 
public abstract void abstractMethod();
public void NonAbstractMethod()
    {
        Console.WriteLine("NonAbstract Method");
    }

}
Rules:
·         Abstract class not have sealed class
·         Abstract class only contain abstract method
·         Abstract class cannot be private
·         Abstract method cant have virtual keyword.because its  explicit virtuval method
·         Abstract class cannot be static
Performance
In our testing, abstract classes with virtual methods have better performance than interface implementation .

Reserve word in C#.net


Keywords in C#.net
C#.net have  77 Reserve word. You are  not declare variable/method in reserve words .if you want to declare reserved word you can use " @ "  symbol.
Example:
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