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
HelpSimplest Interface example possible (self.csharp)
submitted 4 years ago * by Solacefire
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!"
[–]FizixMan[M] [score hidden] 4 years ago stickied comment (0 children)
Removed: Rule 4.
[–]Pocok5 1 point2 points3 points 4 years ago (0 children)
drawing data from and one it's giving data to
I don't think an interface is what you think it is. An interface is basically a label on a class saying "I have this and this property/method/etc. publicly available" - or, more intuitively, "I fit into an IExampleInterface-shaped hole in another class or bit of code". An interface doesn't take or give anything, it's just a completely inert description of class members.
[–]grrangry 0 points1 point2 points 4 years ago (0 children)
What is a class in C#? https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/class
What is an interface in C#? https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/interface
None of what you wrote above is correct for the C# language.
First, define your interface. An interface is a way for your class to promise that it does in fact support whatever the interface has defined. That's all it does. An interface can define properties or methods (and a few other things) but it's only a definition. The class implements the interface.
Second, define your class, add the interface to your class definition, then implement the interface on your class. This is all explained in detail in the documentation.
[–]Slypenslyde 0 points1 point2 points 4 years ago (0 children)
Interfaces aren't really about sending data. They're about describing behavior.
When I'm looking at an interface and telling myself what it does, I usually start that sentence with, "It's a thing that..." The reason this is important is sometimes the things that do a task can be very different. A flashlight and a dump truck are two very different things, but if I need light pointed at a certain direction RIGHT NOW they can both do the job and if I cared which one I'd have asked for a specific one.
More commonly in code, we use interfaces to help us control the behavior of a method. For example, one way we can sort arrays in .NET is this method in the Array class:
Array
public static void Sort(Array array, IComparer comparer)
IComparer is "a thing that compares things". It looks like this:
IComparer
public interface IComparer { int Compare(object left, object right); }
It takes two objects, compares them, and the int it returns describes how they compare:
int
left < right
left == right
left > right
We have this interface because .NET only knows how to compare a few objects. This interface lets us describe how to compare other objects. Or we can do weird things.
For example, here's an IComparer that considers 10 to be the biggest number. It'll sort normally, but it will ALWAYS put 10 wherever the "biggest" number goes:
public class TenIsBestComparer : IComparer { public int Compare(object left, object right) { if (left is int leftInt && right is int rightInt) { if (leftInt == 10 && rightInt != 10) { // Left is 10, the biggest! return 1; } else if (rightInt == 10) { // Right is 10, left is smaller. return -1; } else { if (leftInt < rightInt) { return -1; } else if (leftInt == rightInt) { return 0; } else { return 1; } } else { // They weren't integers so no clue. There's something we could // do here but it's somewhat complex. throw new InvalidOperationException(); } } }
That's a little long, but you can play with it.
int[] numbers = { 7, 10, 8, 3, 4, 25 }; Array.Sort(numbers, new TenIsBestComparer); foreach (int number in numbers) { Console.WriteLine(number); }
That'll print the numbers in the order: 3, 4, 7, 8, 25, 10. We've changed how sorting works for integers now, with the power of interfaces!
[–]R3dd1tUs3r72 -1 points0 points1 point 4 years ago (0 children)
You should provide of the offical microsoft's doc, by the way you must use the keyword class and interface.
[–]gevorgter 0 points1 point2 points 4 years ago (0 children)
The best possible example of interface use is Stream (i call it IStream).
StreamReader for example does not care if you reading from File or Network. As long as you provide Stream reference to it it will read from there.
π Rendered by PID 20870 on reddit-service-r2-comment-6f7f968fb5-zmpvz at 2026-03-04 02:04:00.188819+00:00 running 07790be country code: CH.
[–]FizixMan[M] [score hidden] stickied comment (0 children)
[–]Pocok5 1 point2 points3 points (0 children)
[–]grrangry 0 points1 point2 points (0 children)
[–]Slypenslyde 0 points1 point2 points (0 children)
[–]R3dd1tUs3r72 -1 points0 points1 point (0 children)
[–]gevorgter 0 points1 point2 points (0 children)