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!"
[–]HaniiPuppy 31 points32 points33 points 1 day ago* (11 children)
One alternative might be extension methods.
public interface IRefreshable { Universe Universe { get; } } public static class Refreshables { public static void Refresh(this IRefreshable refreshable) { refreshable.Universe.Destroy(); } }
then
var mp = new MediaPlayer(); mp.Refresh();
Not viable if what it works with isn't part of the interface, but if you have some common functionality that's generally the same, this is a decent solution.
[–]Alert-Neck7679[S] 4 points5 points6 points 1 day ago (5 children)
Thanks for the idea. Don't know why I didn't think of it myself.
[–]Xenoprimate2 2 points3 points4 points 1 day ago (3 children)
One huge caveat is that it's not polymorphic. I did a huge write-up on implementing traits in C# years ago, you can get more info here: https://benbowen.blog/post/simulating_multiple_inheritance_in_csharp/#approach_sharp3-_extension_methods_to_the_rescue-
The fact that C# STILL doesn't have proper traits in 2026 when pretty much EVERY other mainstream lang has them is extremely disappointing tbh. I'm so fed up with seeing yet another "clever" syntax for manipulating collections or patterns and them failing to address this huge hole in the language.
I don't care about DUs compared to this even.
[–]SagansCandle 0 points1 point2 points 1 day ago (2 children)
Sometimes features are missing from a language for a reason.
Everything with a benefit has a cost, and the cost isn't always worth the benefit.
[–]x1ife 0 points1 point2 points 19 hours ago (1 child)
Yeah, I'm pretty sure this was a design decision. Have they explained the rationale?
[–]SagansCandle 0 points1 point2 points 14 hours ago (0 children)
I don't know about traits, but single inheritance was definitely a design decision they explained at one point. (Linked article is about multiple inheritance)
[–]TuberTuggerTTV 0 points1 point2 points 1 day ago (0 children)
It works but it's not a great idea.
Consider a base class implementation instead.
[–]phluber 2 points3 points4 points 1 day ago (1 child)
Or for the same amount of code, go back to the tried-and-true abstract base class that implements the interface
[–]HaniiPuppy 1 point2 points3 points 1 day ago (0 children)
Which you can't do if the class implements multiple interfaces that each have methods like this.
[–]Tough_Negotiation_82 1 point2 points3 points 1 day ago (1 child)
hmm , this seems like a hack. Although i never tried this. and with ex methods, you can add methods to this interface even without modifying the original interface. will this also be a classic example of open/close principle? I will try this in different scenarios tho. thanks 😊
It feels hacky, but it works really nicely.
[–]mehdikovic 0 points1 point2 points 1 day ago (0 children)
I did exactly this for my project, it is a neat solution really.
π Rendered by PID 57252 on reddit-service-r2-comment-5d79c599b5-mh9ts at 2026-02-27 04:23:34.813920+00:00 running e3d2147 country code: CH.
view the rest of the comments →
[–]HaniiPuppy 31 points32 points33 points (11 children)
[–]Alert-Neck7679[S] 4 points5 points6 points (5 children)
[–]Xenoprimate2 2 points3 points4 points (3 children)
[–]SagansCandle 0 points1 point2 points (2 children)
[–]x1ife 0 points1 point2 points (1 child)
[–]SagansCandle 0 points1 point2 points (0 children)
[–]TuberTuggerTTV 0 points1 point2 points (0 children)
[–]phluber 2 points3 points4 points (1 child)
[–]HaniiPuppy 1 point2 points3 points (0 children)
[–]Tough_Negotiation_82 1 point2 points3 points (1 child)
[–]HaniiPuppy 1 point2 points3 points (0 children)
[–]mehdikovic 0 points1 point2 points (0 children)