To C# people: What do you think about this?

C# is a language I most enjoy working with. But with C# 8.0 out, we've gain this piece of technology:

Default Interfaces Methods:

I used it in no project, and I've never seen something like that in any other language I worked. What do you think? To me, it makes no sense at wall, we just have abstract classes to this kind of job, and the rest we can handle using pure OOP, in my opinion.

Start a personal dev blog on your domain for free and grow your readership.

3.4K+ developers have started their personal blogs on Hashnode in the last one month.

Write in Markdown · Publish articles on custom domain · Gain readership on day zero · Automatic GitHub backup and more

Abhishek Duppati's photo

C# 8.0 introduces a new feature called Default implementations in Interfaces and this changes many things.

Interfaces can now have the default implementation of methods. Interfaces can now have Private members. Interfaces can now have static members, this is used for parameterization of the default implementation. Interfaces can now have protected members which are not accessible by the derived class but can be accessible with a derived interface. If a class wants to implement the protected member, it has to be done by implementing the interface explicitly. Interfaces can also have virtual members, but the class can’t override the method but an interface can.

We can think that Interfaces and abstract are somewhat the same now, But an interface cannot have an Instance state, instance fields, instance auto-properties, cannot define class level fields or variables whereas an abstract class can have state.

There are some reasons stated for this change: Extending APIs, Interoperability with Android, iOS, and supporting the traits language feature.

Hermis's photo

Yes, I think learn c# online language is the easiest and fastest to learn! The basic language is quite easy, but if you are going to learn data structures and algorithms, it may take time, but my experience with was awesome!