Open n9 opened 10 years ago
No, that probably is a bug. Can you send the entire interface definition?
[Imported]
public interface Test
{
int X { [InlineCode("{this}[0]")] get; }
}
Actually, I mixed up [Imported] and [Serializable].
Yes, GeneratedMethodName is currently required for all interface methods, the intended use for being able to specify inline code on interface methods at all is to enable eg. IComparable
, where call to the interface methods must go to a global method, which will in turn (sometimes) delegate to the implementation method.
Not sure whether I understand properly:
For what is the GeneratedMethodName
used in my imported interface?
If it is required for something, could it just take as a default value "get_X" or something similar?
The problem is that your imported interface can be implemented:
class C : Test {
public int X { get { return 42; } }
}
and the implementer/caller expects that ((Test)new C()).X
should return 42.
But in case it contains [InlineCode], should it return error when being implemented?
Could GeneratedMethodName
have some default value e.g. name of the member?
I don't like the idea of a default value for the GeneratedMethodName, that name has to be used (directly or indirectly) by the code specified as the inline implementation.
But I guess we could allow methods for imported methods to not specify it, and then make it an error for non-imported types to implement those interfaces.
Ok.
I have an
[Imported]
interface and I am getting:Is
GeneratedMethodName
really required also for[Imported]
interfaces?