© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
6 replies
Binto86

✅ Can't have interface with abstract static method as parameter in blazor component

I have interface and class like this:
interface IFoo
{
  static abstract IFoo Create();
  void SomeFunction();
}

class Foo : IFoo
{
  public static IFoo Create() => new Foo();
  public void SomeFunction() { }
}
interface IFoo
{
  static abstract IFoo Create();
  void SomeFunction();
}

class Foo : IFoo
{
  public static IFoo Create() => new Foo();
  public void SomeFunction() { }
}


now i want to have
IFoo
IFoo
as parameter in blazor component like this:
[Parameter]
public IFoo MyFoo { get; set; }
[Parameter]
public IFoo MyFoo { get; set; }


but when i try to pass instance of Foo into the component i get this error:
CS8920    The interface 'IFoo' cannot be used as type argument. Static member 'IFoo.Create()' does not have a most specific implementation in the interface.
CS8920    The interface 'IFoo' cannot be used as type argument. Static member 'IFoo.Create()' does not have a most specific implementation in the interface.


Any way to fix this?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ Can I use static abstract interface members in netstandard2.1?
C#CC# / help
4y ago
Can't access interface method
C#CC# / help
2y ago