© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
34 replies
SWEETPONY

How to check options for null?

I have this:
var options = Configuration.GetSection(nameof(Patterns));
services.Configure<Patterns>(options);                   
var options = Configuration.GetSection(nameof(Patterns));
services.Configure<Patterns>(options);                   


in controller:
public ZeebeController(
  KafkaSettings kafkaSettings,
  IZeebeClient zeebeClient,
  IOptions<Patterns> options)
{ 
}
public ZeebeController(
  KafkaSettings kafkaSettings,
  IZeebeClient zeebeClient,
  IOptions<Patterns> options)
{ 
}


all I want is check options from startup for null but I can't just write
if(options == null)
if(options == null)
404ecf201c2e7a8e.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

✅ How to automatically check for null?
C#CC# / help
3y ago
Null check
C#CC# / help
15mo ago
NullReferenceException but checking for Null?
C#CC# / help
2y ago
✅ Null check not enough to safely convert from nullable enum
C#CC# / help
3y ago