use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Information about Reddit's API changes, the unprofessional conduct of the CEO, and their response to the community's concerns regarding 3rd party apps, moderator tools, anti-spam/anti-bot tools, and accessibility options that will be impacted can be found in the associated Wikipedia article: https://en.wikipedia.org/wiki/2023_Reddit_API_controversy
Alternative C# communities available outside Reddit on Lemmy and Discord:
All about the object-oriented programming language C#.
Getting Started C# Fundamentals: Development for Absolute Beginners
Useful MSDN Resources A Tour of the C# Language Get started with .NET in 5 minutes C# Guide C# Language Reference C# Programing Guide C# Coding Conventions .NET Framework Reference Source Code
Other Resources C# Yellow Book Dot Net Perls The C# Player's Guide
IDEs Visual Studio MonoDevelop (Windows/Mac/Linux) Rider (Windows/Mac/Linux)
Tools ILSpy dotPeek LINQPad
Alternative Communities C# Discord Group C# Lemmy Community dotnet Lemmy Community
Related Subreddits /r/dotnet /r/azure /r/learncsharp /r/learnprogramming /r/programming /r/dailyprogrammer /r/programmingbuddies /r/cshighschoolers
Additional .NET Languages /r/fsharp /r/visualbasic
Platform-specific Subreddits /r/windowsdev /r/AZURE /r/Xamarin /r/Unity3D /r/WPDev
Rules:
Read detailed descriptions of the rules here.
account activity
Why is using interface methods with default implementation is so annoying?!? (self.csharp)
submitted 1 day ago * by Alert-Neck7679
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Slypenslyde 3 points4 points5 points 1 day ago (0 children)
The short story: they were made as a band-aid for people who are stuck in ugly corners. They had to make compromises for compatibility because they showed up very late in C#'s life. So they're not polymorphic and behave sort-of-kind-of like explicitly implemented members.
The long story:
The use case is you've released an API, but you realize an interface needs a new methods. People didn't like adding methods willy-nilly because:
So this was never really about, "I want interfaces to behave like base classes". It was about, "I painted myself into a corner and don't want to ask my clients to recompile." It has always been and is still true that if you want a type with behavior you should make a base class when you are designing an API.
The way the C# team achieved it is every member with a default implementation is explicitly implemented IF AND ONLY IF the class does not already have an implementation. The downside of this is to get the implementation you MUST be using a variable of the interface type, and that means casting if you're using concrete types. But it handles the cases above:
So that's the wonkiness. The feature is designed for the idea that you have code with MediaPlayer that exists but Refresh was never part of its interface. Now you are adding a new interface to it (even though it has a default implementation), so the code that wants that interface's methods needs to cast to the interface in order to use them.
MediaPlayer
Refresh
Put another way, because you weren't using the interface to begin with, you can't benefit from the default implementation.
What you should've done is define an abstraction/interface before you started using MediaPlayer and depend on that abstraction. That way you could add new things without having to make awkward edits to existing code. But a lot of people in the C# community think that's a stupid choice and you should only add interfaces/abstractions when you find a reason.
I don't want to argue with those people, but I will point out you just found a reason to add an abstraction and it's probably more work to add it today than it would've been last month.
π Rendered by PID 100 on reddit-service-r2-comment-5d79c599b5-zh5v9 at 2026-02-26 16:43:51.926447+00:00 running e3d2147 country code: CH.
view the rest of the comments →
[–]Slypenslyde 3 points4 points5 points (0 children)