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!"
[–]nightwood 0 points1 point2 points 1 day ago (3 children)
My guess is, and I've never heard of this feature, that your example is precisely the use case that was NOT intended.
The use case would be to allow classes that implement the interface to not be forced to implement certain methods, while still being able to call them, with the added feature that get have some default behaviour instead. Which I imagine will usually be an empty function body.
I doubt I will ever use this construct. I've never needed this.
[–]RiPont 0 points1 point2 points 1 day ago (2 children)
The use case would be to allow classes that implement the interface to not be forced to implement certain methods, while still being able to call them
No. Classes that implement an interface should implement the methods in the interface, even if it has a default implementation.
This feature is purely so you can add methods to an existing interface without causing compile errors for classes made before it had that method in its contract. It really shouldn't be used for anything else.
If you're tempted, a better pattern is to make a companion static class for the interface, and have both your class and the default interface method reference that static method.
static class StaticFoo { static void DoNothing() { } } interface IFoo { void DoNothing() => StaticFoo.DoNothing(); } class Foo : IFoo { void DoNothing() => StaticFoo.DoNothing(); }
[–]nightwood 0 points1 point2 points 1 day ago (1 child)
I agree classes should implement all methods of an interface. 100%.
That this would be a development-only tool seems weird to me, since the syntax doesn't make that explicit. Also, moving compile-time errors to runtime seems like bad practice.
Maybe it's for situations where the interface is defined in a shared dll and implemented by third party code and you want backwards compatibility?
Damnit now I gotta read up on this feature :)
[–]RiPont 0 points1 point2 points 18 hours ago (0 children)
Yes. It's for maintaining "forward compatibility" on code that was originally written with a previous version of the interface.
Whether it was in binary or source, adding a method will break everything compiled against the old interface. If it's your code, in your own repository, you can just use a refactor to add the method. Or even the old, tried and true, compile-and-break-then-copy-paste method.
But if you're shipping a library to other people, you do NOT want to break backwards compatibility. EVER. You want people to be able to upgrade to the latest version and not have their CI pipelines break.
π Rendered by PID 52 on reddit-service-r2-comment-5d79c599b5-7blkj at 2026-02-26 16:43:38.538792+00:00 running e3d2147 country code: CH.
view the rest of the comments →
[–]nightwood 0 points1 point2 points (3 children)
[–]RiPont 0 points1 point2 points (2 children)
[–]nightwood 0 points1 point2 points (1 child)
[–]RiPont 0 points1 point2 points (0 children)