.net - C# Extending generic method -


good day,

is there way extend generic method? example

i have such method:

public t dosomethingaboutit<t>() { //do magic } 

what want have extended method such as:

private static t extended<t, l>(this t o, func<t, l> func) {     return default(t); } 

is extension possible?

edit: call dosomethingaboutit().extended...

it's possible still have follow rules of extension methods (msdn).

this code compiles fine...

internal class program {     private static void main(string[] args)     {         int y = 1;         int z = y.extended(n => "hi!");     } }  public static class x {     public static t extended<t, l>(this t o, func<t, l> func)     {         return default(t);     } } 

Comments