Hello,
when creating an extension class, the extension class is not defined as static, but the C# documentation indicates that a class implementing extension methods should be static.
What do you mean?
I tried:
extension method String.Test: String;
implementation
extension method String.Test: String;
begin
end;
and got this out of it:
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace issueextmtest
{
[CompilerGenerated]
[StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)]
public static class __Extensions
{
public static string Test(this string self)
{
string Result;
return Result;
}
}
}
Carlo,
I’m talking about an extension class:
StringExtension = public extension class (String);
public
method test : String;
end;
hrmm it should be sealed. But note that extension classes are not the same as standalone extension methods. They’re an Elements specific feature.
Carlo,
from the Elements documentation, I though that defining an extension method inside an extension class would be about the same as defining a stand-alone extension method. The only difference being that we control the name of the defining class, so it is more documentation-friendly.
If it’s not the same, perhaps the documentation should point the differences.