How to validate multiple user input integers using delegate in C#?
Hi,
I do not understand your problem.
Can you be more specific?
What are you trying to do ?
Regards.
I want to create application in visual studio but i want a method that i can parse multiple inputs to validate numbers/integers.
I’m sorry to say, but to me it is still pretty vague. I don’t understand what delegates have to do in this.
Can you provide a clear example ?
Because to me as is it looks just like
public static bool MyMethod(int n1, int n2){
// Some validation logic. For instance
return (n1 == 2*n2);
}
In C#, a delegate is a type that represents a reference to a method. It can be used to pass methods as arguments to other methods or to store methods as variables. To validate multiple user input integers using a C# delegate, you can define a method that takes an integer as input and returns a boolean value indicating whether the input is valid or not. You can then create a delegate that points to this method and use it to validate each user input integer.