Technology Guruu

  • Home
  • Site Info
    • About Us
    • Disclaimer
    • Privacy Polacy
  • Home
  • Digital Marketing
    • SEO
    • SMM
    • SEM
  • Quotes
  • Technical
  • Java
  • .Net
    • C#.Net
    • ASP.Net
  • Keychains

Tuesday, 10 October 2017

Brief description about Delegates

 Akansha     16:30:00     TechnicalQuestions     No comments   

Introduction about delegates and why delegates are came the main purpose of delegates how to useful and what are the advantages and disadvantages and types of delegates all are provided in this article.

Best Tutorial about Delegates

brief introduction about delegates
Introduction

Delegates Introduction

  • Delegates are similar like C++ function pointers
  • To define we have to use delegate keyword,delegate are reference types.
  • delegate can hold the address of a function,using delegate object we can invoke a method without using method name.

Delegates are 2 types

1.Single caste Delegate

It can hold address of a single method

2.Multi Cast delegate:

  • It can  hold adresses of multiple methods
  • using multicast delegate we can ivoke multiple methods with a single call.

Implementation of delegate concept can be divided into following steps
Step1: Defining a class
step2: Defining a method
Step3: Defining a delegate
<Syntax>
<accessmodifier>delegate<returntype><delegatename>(<type><arg1>,<type><arg2>);
step4:creating object for delegateand initializing the method name
<delegatename><delegate objname>=new <delegatename>(<methodname>);
Step5: invokin the method by using delegate object
<delegate ojjname()>;
delegate are called as type function pointers because delegate declaration should follow the mathod declaration which is holding by the delegate object that means method return type and signature should be same for delegate.
Note:
Delegate can hold the address of static methods as well as instance methods.
Example to invoke instance methods by using delegate object(single cast delegate)
namespace singlecastDelegateex1
{
class calculate
{
internal int add(int a,int b)
{
return a+b;
}

}
internal delegate int Mydelegate(int x,int y);
class Program
{
void main()
{
calculate obj=new calculate();
MyDelegate delobj=new MyDelegate(obj.add);
int res=delobj(10,5);
console.WriteLine("addition result is :"+res);
console.ReadLine();
}
}
}
Friends you like my post please share to your friends through Facebook,Twitter,Google+.
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Email ThisBlogThis!Share to XShare to Facebook

Related Posts:

  • Types Of Software Applications in .NET Types Of Software Applications types of s/w      Software applications are classified into various types based on application b… Read More
  • Web User Control in asp.net Web User Control in .net Whenever we want to consume a user control in single web application then we will go for "Web User Control". That m… Read More
  • Logical C#.Net Program for ATM machine .Net is a frame work it is a software in this we are execute 64+ languages like C#.net,vb.net,Asp.net etc.Now a days every company develop projects … Read More
  • Logical Programs And Answers In C#.NET .Net is a frame work it is a software in this we are execute 64+ languages like C#.net,vb.net,Asp.net etc.Now a days every company develop projects … Read More
  • DDL Commands in SQL-sql query tool SQL  DDL Commands SQL is a Structured Query Language it is the Back End language we have the Front End languages are Java,C#.net,vb.Net,PHP et… Read More
Older Post Home

0 comments:

Post a Comment

Popular Posts

  • Love Failure Quotes and Sad valentines day Quotes
    We Love Someone is a easy process sometime takes long time to love someone love others within short period but anyway always love dependin...
  • Brief Description about Multicast Delegate
    Multicast delegate is an extension of normal delegate. It helps you to point more than one method at a single moment of time. Multicast ...
  • Top 10 valentine's day Quotes and Greetings wishes
    All Lovers have Anxiety in Valentines day because it is a festival to all lovers in these they enjoy a lot and celebrate the Valentine...
  • Missing My Friend Quotes : Friendship Day Quotes 2017
    Friends today my article about missing friends and moments with them. Here you are seen the best friendship quotes and some  feelings when...
  • Brief description about Delegates
    Introduction about delegates and why delegates are came the main purpose of delegates how to useful and what are the advantages and disadv...
  • Wonderful sayings about Life.
    I Believe Follow  Things(Life Quotes) I Believe I believe: ********** Believe in Life ********** That we don't have to chan...
  • swami vivekananda best motivational Quotes
    Some Peoples are always have a negative thinking & bad mood their heart always filled with sadness & they are in depression mood.e...
  • Top 10 Words Of Encouragement and encouraging quotes
    Friends when you are depression mood everyone have some encouragement words that gives boost strength for You i feel these quotes helpful ...
  • Na Tanu Samjhawan Ki Song lyrics
    Na Tanu Samjhawan Ki Song Lyrics With English Translation Movie : Humpty Sharma ki Dulhaniya Song : Samjhawan Song Singer : Arijit ...
  • Detail Introduction about C#.Net
    Brief Introduction about C#.Net  Introduction C#.Net is the one of the Programming Language the .Net Framework also contains ano...

Categories

  • Entertainment (67)
  • TechnicalQuestions (58)
  • Quotes (11)
  • C#.Net (8)
  • Java (8)
  • ValentinesDay (4)
  • SEO (3)
  • Home
  • About Us
  • Disclaimer
  • Privacy Policy
  • Sitemap

Copyright © 2015-2017 Good Friends 5.All Rights Reserved• And Our Sitemap • All Logos and Trademark Belongs To Their Respective Owners•