C#C
C#3y ago
cap5lut

✅ Make method implemented in interface accessible from implementing type

i have an interface
interface ICL
{
  public IEnumerable<ICLPlatform> GetPlatforms()
  {
    // code
  }
}
and an implementing struct
struct CLAdapter : ICL
{
}

now GetPlatforms() isnt reachable via new CLAdapter().GetPlatforms(), how can i make that accessible?

i tried implementing it in the adapter by simply casting this to ICL, but then i run into stack overflows
    /// <inheritdoc/>
    public IEnumerable<ICLPlatform> GetPlatforms()
    {
        return ((ICL)this).GetPlatforms();
    }
Was this page helpful?