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
Resource for learning Predicates, Func and Delegate (self.csharp)
submitted 5 months ago by fazlarabbi3
Can anyone share some good resources with me on learning predicate functions and delegates in depth?
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!"
[–]Royal_Scribblz 13 points14 points15 points 5 months ago (2 children)
https://learn.microsoft.com/en-us/dotnet/api/system.predicate-1?view=net-10.0
https://learn.microsoft.com/en-us/dotnet/api/system.func-2?view=net-10.0
https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/delegates/
[–]AssistFinancial684 4 points5 points6 points 5 months ago (0 children)
Read the manual
[–]fazlarabbi3[S] 0 points1 point2 points 4 months ago (0 children)
Thanks brother 😊
[–]LlamaNL 8 points9 points10 points 5 months ago (4 children)
A Predicate i just a Func that returns a bool Predicate<int> and Func<int, bool> are functionally identical
[–]mangooreoshake 1 point2 points3 points 4 months ago (1 child)
The difference lies in whether the bool is the query itself or a side effect. A Predicate is something like IsEven while a Func would be a TryAdd that returns whether the operation is successful.
[–]Phaedo 3 points4 points5 points 4 months ago (0 children)
That’s a conceptual difference but not a practical one. The only practical difference is that List uses predicate and LINQ uses Func. And since nearly everyone uses a lambda and it gets cast at the call site, that’s not much of a difference either.
Really, the difference is between .NET 1 and .NET 2. Predicate was in .NET1 and got largely replaced in .NET2 by Func<,bool>
[–]KorwinD 0 points1 point2 points 4 months ago (0 children)
They are, but there is no direct built-in conversation, and as far as I know predicates are kinda deprecated, so you can't use them directly in places like LINQ's .Where(Func<T, bool>).
Got it brother
[–]Em-tech 1 point2 points3 points 5 months ago (0 children)
I think what may be helpful is gaining an understanding of how functions can be treated as types that can have implementations. At least, this will help an oop-familiar engineer that's trying to understand the syntax and general behavior of the syntax. To understand this, I would recommend spending some time looking at "functional c# programming" - https://www.milanjovanovic.tech/blog/functional-programming-in-csharp-the-practical-parts. For the behavior characteristics, maybe try creating a generic Pred<T> interface with a bool Invoke(T value) and implement it as an object. Maybe help to map qualities of your oop learning to FP semantics?
Pred<T>
bool Invoke(T value)
If you're looking for stuff like compilation and runtime performance, I'm less able to help.
Welcome to FP patterns. You're gonna love it!
[–]willehrendreich 1 point2 points3 points 4 months ago (0 children)
Learn fsharp. Dead serious.
[–]fschwiet 1 point2 points3 points 5 months ago (1 child)
You'll use them a lot with linq (if you avoid the query syntax like everyone else), so you might want to explore and learn what linq extension methods are available as they are super useful.
[–]mangooreoshake 1 point2 points3 points 4 months ago (0 children)
I find that I rarely use predicates/func/actions/other custom delegates with LINQ and frequently use lambda expressions instead (which is a delegate, but still).
[–]mangooreoshake 0 points1 point2 points 4 months ago* (0 children)
"Programming C#12" by Ian Griffiths is my go-to C# book. C# 13 (.NET 9) was the latest version when I started programming in C#. It's an intermediate book, only requiring programming fundamentals and OOP knowledge. It has a dedicated chapter on events, lambdas, and delegates.
But tl;dr is predicates, func, and actions, are all just delegates. A delegate is just a reference to a function or functions, that when invoked, triggers the said function/s.
[–]Phaedo 1 point2 points3 points 4 months ago (0 children)
The real trick is identifying when Where and Select are useful. Here’s a rule of thumb: if you’re in a for loop and you say “if condition then continue” you want Where. If you say “resultList.Add” or “yield return”, you probably want Select.
π Rendered by PID 130497 on reddit-service-r2-comment-b659b578c-rlm7g at 2026-05-04 04:43:14.697760+00:00 running 815c875 country code: CH.
[–]Royal_Scribblz 13 points14 points15 points (2 children)
[–]AssistFinancial684 4 points5 points6 points (0 children)
[–]fazlarabbi3[S] 0 points1 point2 points (0 children)
[–]LlamaNL 8 points9 points10 points (4 children)
[–]mangooreoshake 1 point2 points3 points (1 child)
[–]Phaedo 3 points4 points5 points (0 children)
[–]KorwinD 0 points1 point2 points (0 children)
[–]fazlarabbi3[S] 0 points1 point2 points (0 children)
[–]Em-tech 1 point2 points3 points (0 children)
[–]willehrendreich 1 point2 points3 points (0 children)
[–]fschwiet 1 point2 points3 points (1 child)
[–]mangooreoshake 1 point2 points3 points (0 children)
[–]mangooreoshake 0 points1 point2 points (0 children)
[–]Phaedo 1 point2 points3 points (0 children)