کار با delegate : متود بی نام که یک مقدار را return می کند در #C
سلام بر تمامی برنامه نویسان سی شارپ 😉 در این مطلب ، کار با delegate : متود بی نام که یک مقدار را return می کند در سی شارپ #C رو براتون آماده کردم. انشاالله که این کد براتون مفید باشه.
خروجی پروژه به این صورت می باشد:
end:3
Summation of 3 is 3
end:5
Summation of 5 is 5
Summation of 3 is 3
end:5
Summation of 5 is 5
کار با delegate : متود بی نام که یک مقدار را return می کند :
delegate int CountIt(int end);
class MainClass {
public static void Main() {
CountIt count = delegate (int end) {
Console.WriteLine("end:"+end);
return end;
};
class MainClass {
public static void Main() {
CountIt count = delegate (int end) {
Console.WriteLine("end:"+end);
return end;
};