I am creating a Binding Library from a AAR lib in order to generate a dll that I would be able to use in a Xamarin.Android project.
I have an issue because of a Java authorized syntaxe which is not authorized in C#
How would you write this Java code in C# ?
public interface IParent{
}
public interface IChild extends IParent{
}
public interface IGetter{
IParent getAttribute();
}
public class MyClass implements IGetter{
public IChild getAttribute() {
return null;
}
}
The automatic binding file generated gives me this king of result, which is not authorized
public interface IParent
{
}
public interface IChild : IParent
{
}
public interface IGetter
{
IParent Attribute { get; }
}
public class MyClass : IGetter
{
public IChild Attribute { get; } //Not allowed but is the exact Java equivalent
//public IParent Attribute { get; } //Allowed but not the exact Java equivalent
}
I get the following error :
'MyClass' does not implement interface member 'IGetter.Attribute'. 'MyClass.Attribute' cannot implement 'IGetter.Attribute' because it does not have the matching return type of 'IParent'.
I am thinking about creating a entire class that would do the bridge between IChild and IParent, but it must be another solution more suitable...
Thank you @fredrik
Here is the solution I found thanks to your comment :
Using templates was indeed the solution.