CSharp · Console
using System;
public class Program
{
public static void Main()
{
Console.WriteLine("Demo is going to be created");
var d = new Demo();
Console.WriteLine("Demo has been created");
}
}
public class Demo
{
public Demo()
{
Console.WriteLine("Running constructor");
}
private IService _service;
Action<Guid> action = CreateAction();
public static Action<Guid> CreateAction() // Will get compile error above if we remove "static" here
{
Console.WriteLine("Running CreateAction");
return null;
}
}
public interface IService { }