Skip to content

What Interface Methods are useful for? #30663

Open
@paciox

Description

@paciox

1 Forced cast:
image

Nonsense. Who inherits interface should be able to call. It has to implement every member of base interface so it can safely call that method without that extra cast

2.Parametrization
This is even more ridiculous
image

You have to write a ton of extra code.
Just let Roslyn or your boilerplate code generation to handle the fact that variables need to be initialized and used as parameters.
It should really be like this:
image

  1. The use of access modifiers here doesn't make any sense?
    image

Ehm no????
Interface require you to implement methods.
You could just let people override it with their own implementation. Protected is not needed?????

When one overrides base interface method it will call the inheriting class method, else the interface one.

This has to be the most useless thing ever

Calling the static method through the interface it's the same exact thing as doing any other utility static class.....
You can't do anything with it as you have to give an instance to use properties inside it and interface can't have any so everything is passed as a parameter and therefore useless. Any static class can do the same stuff without this convolute interfaces workaround


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions