© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•16mo ago•
24 replies
Potassium

fastest way to check if list doesn't contain null ?

I have a list of reference type (for example, list of string) as constructor parameter. Now i require that all of the list element must not be null. Everytime the object instance is created, the constructor will loop through the list to verify that none of the element is null. However, this have performance impact to immutable class where any modification require creating new instance of the class (because immutable class can't be modified). Is there faster way to check that list element cannot be null?
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

Fastest way to change all items in a nested list
C#CC# / help
4y ago
Null check
C#CC# / help
15mo ago
Better way to check a list of characters?
C#CC# / help
2y ago
❔ fastest way to add a datatable to database
C#CC# / help
3y ago