question

KennethBallen-6863 avatar image
0 Votes"
KennethBallen-6863 asked Viorel-1 answered

How to check if all parameters a set

hello i have a little problem with my project.

My project gets from the user an array with 5 places these are also parameters for a key that I generate. now I want to check before the key is generated if the user has also set all 5 parameters (array entries) and if not it should come in error. how can I do this? sorry for my bad english

dotnet-csharp
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Viorel-1 avatar image
0 Votes"
Viorel-1 answered

For example, in case of strings, you can use Any:

 string[] parameters = new string[5];
    
 // . . .
    
 if( parameters.Any(string.IsNullOrWhiteSpace))
 {
     // ERROR; some values are not provided
     . . . .                        
 }


Show details if your parameters are different.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.