Skip to content

Add support for C# Delegates #71

Description

@Joshua2000B

C# delegates are currently not collected. The are essentially defining a function pointer in C# - need to discuss how to categorize them.

public delegate void LogMessage(string message);

public static void LogToConsole(string text) => Console.WriteLine($"Console: {text}");
public static void LogToFile(string text) => System.IO.File.WriteAllText("log.txt", text);

// Instantiate the delegate by assigning a method group
LogMessage logger = LogToConsole;

// Invoke the method through the delegate variable
logger("Application started."); 

// Dynamically change the method target at runtime
logger = LogToFile;
logger("An error occurred.");

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions