© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
43 replies
Cubic

How to make an expression as short as possible

To any min maxxers out there, i am trying to shrink these few lines to inhuman extremes for.. no reason really. GetEffectsOfType(uint type, int baseValue) returns the total value of effects of type "type" or null if it finds none. I want "value" to remain null if there were no effects found in the entire foreach, otherwise it has to have the total value. This code works, i was just thinking if there was a way to go smaller, maybe making more use of the null coalition operator ??.
image.png
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

FizzBuzz as short as possible
C#CC# / help
4y ago
✅ How to deserialize as fast as possible?
C#CC# / help
4mo ago
How to parse an expression that is a function
C#CC# / help
4y ago
❔ How to calculate event expression?
C#CC# / help
3y ago