Skip to content

Commit

Permalink
dotnet-added-delegate-example
Browse files Browse the repository at this point in the history
  • Loading branch information
rajjitlai committed Oct 16, 2024
1 parent 69055c3 commit 84fb396
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
24 changes: 24 additions & 0 deletions dotNET/theory/delegateExample/Program.cs
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
10 changes: 10 additions & 0 deletions dotNET/theory/delegateExample/delegateExample.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
25 changes: 25 additions & 0 deletions dotNET/theory/delegateExample/delegateExample.sln
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 84fb396

Please sign in to comment.