From 84fb3967f7b6d0a10f827edb36e5e5587ab91dda Mon Sep 17 00:00:00 2001 From: RAJJIT <2.0lairaj@gmail.com> Date: Wed, 16 Oct 2024 20:29:49 +0530 Subject: [PATCH] dotnet-added-delegate-example --- dotNET/theory/delegateExample/Program.cs | 24 ++++++++++++++++++ .../delegateExample/delegateExample.csproj | 10 ++++++++ .../delegateExample/delegateExample.sln | 25 +++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 dotNET/theory/delegateExample/Program.cs create mode 100644 dotNET/theory/delegateExample/delegateExample.csproj create mode 100644 dotNET/theory/delegateExample/delegateExample.sln diff --git a/dotNET/theory/delegateExample/Program.cs b/dotNET/theory/delegateExample/Program.cs new file mode 100644 index 0000000..731fa76 --- /dev/null +++ b/dotNET/theory/delegateExample/Program.cs @@ -0,0 +1,24 @@ +using System; +namespace delegateEg +{ + // declaring delegate + public delegate void dd(int x, int y); + + class A + { + public void addition(int a, int b) + { + Console.WriteLine("Addition = {0}", a+b); + } + } + + class Program + { + static void Main(string[] args) + { + A obj = new A(); + dd obj2 = obj.addition; + obj2(5, 10); + } + } +} \ No newline at end of file diff --git a/dotNET/theory/delegateExample/delegateExample.csproj b/dotNET/theory/delegateExample/delegateExample.csproj new file mode 100644 index 0000000..2150e37 --- /dev/null +++ b/dotNET/theory/delegateExample/delegateExample.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/dotNET/theory/delegateExample/delegateExample.sln b/dotNET/theory/delegateExample/delegateExample.sln new file mode 100644 index 0000000..d327574 --- /dev/null +++ b/dotNET/theory/delegateExample/delegateExample.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.12.35323.107 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "delegateExample", "delegateExample.csproj", "{8630A501-E0F6-41F4-B924-47BC7BA49225}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8630A501-E0F6-41F4-B924-47BC7BA49225}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8630A501-E0F6-41F4-B924-47BC7BA49225}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8630A501-E0F6-41F4-B924-47BC7BA49225}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8630A501-E0F6-41F4-B924-47BC7BA49225}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {76306F7A-E242-43F4-BA9C-17FD66E047AA} + EndGlobalSection +EndGlobal