C# Corner
Tech
News
Videos
Forums
Trainings
Books
Events
More
Interviews
Jobs
Live
Learn
Career
Members
Blogs
Challenges
Certifications
Bounties
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
Delegate Array in C#
WhatsApp
Noor Mohamed
Jul 02
2015
5.3
k
0
0
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
namespace
ArrayDelegates
{
public
delegate
string
Delegatearray(
string
a);
class
Delegate_Array
{
static
string
Str_Reverse(
string
x)
{
string
S =
new
string
(x.ToCharArray().Reverse().ToArray());
return
S;
}
static
string
Str_Length(
string
x)
{
string
S = Convert.ToString(x.Length);
return
S;
}
static
void
Main(
string
[] args)
{
string
call;
Delegatearray[] Darray = {
new
Delegatearray(Delegate_Array.Str_Reverse),
new
Delegatearray(Delegate_Array.Str_Length) };
for
(
int
i = 0; i < Darray.Length; i++)
{
call=Darray[i](
"C-SHARP"
);
Console.WriteLine(call);
}
Console.ReadKey();
}
}
}
Delegate
C#
Array
Up Next
Delegate Array in C#