-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
38 lines (32 loc) · 1.07 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
namespace StaticAbstractMembersInInterfaces
{
/// <summary>
/// https://stackoverflow.com/questions/3284/why-cant-i-have-abstract-static-methods-in-c
/// https://blog.ndepend.com/c-11-static-abstract-members/
/// https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/tutorials/static-virtual-interface-members
/// </summary>
public interface IHandler
{
static abstract string Template { get; }
static abstract string Method { get; }
static abstract string Handle { get; }
}
public record struct HelloWorld : IHandler
{
public static string Method => "GET";
public static string Template => "/";
public static string Handle => "Hello World";
public override string ToString()
{
return $"Method:{Method} Template:{Template} Handle:{Handle}";
}
}
public class Program
{
public static void Main(string[] args)
{
HelloWorld hello = new HelloWorld();
Console.WriteLine(hello);
}
}
}