C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
.NET
ADO.NET
Android
ASP.NET
C#
Databases & DBA
Design Patterns & Practices
iOS
Java
OOP/OOD
SharePoint
Software Testing
Web Development
WPF
View All
3
Reply
What are delegates and why are they required?
John
13y
6.5k
0
Reply
Delete Row
Delete Column
Insert Link
×
Insert
Cancel
Embed YouTube Video
×
Width (%)
Height (%)
Insert
Cancel
Table Options
×
Rows
Columns
First row as header
Create Table
Insert Image
×
Selected file:
Alignment
Left
Center
Right
Select an image from your device to upload
Upload to Server
Cancel
Submit
A delegate is a type that references a method. Once a delegate is assigned a method, it behaves exactly like that method. The delegate method can be used like any other method, with parameters and a return value, as in this example:public delegate int PerformCalculation(int x, int y);
Amit Patel
13y
2
Delegate is a function pointer. We can pass method as a parameter.Public Delegate bool DelActive();Static voind main() {DelActive a= new DelActive(IsDone);IsUser(a); bool IsDone() {int x=10;if(x==10) {return true; } else {return false; } } }Class sample {Public bool IsUser(DelActive active) {if(active) { return true; } else {return false; } } }
Pramod Verma
10y
0
Delegate is a function pointer. We can pass method as a parameter.Public Delegate bool DelActive();Static voind main() {DelActive a= new DelActive(IsDone);IsUser(a); bool IsDone() {int x=10;if(x==10) {return true; } else {return false; } } }Class sample {Public bool IsUser(DelActive active) {if(active) { return true; } else {return false; } } }
Pramod Verma
10y
0
What are the type conversions in C#?
What is the use of GetCommandLineArgs() method in C#.NET?
Message