P
Paul E Collins
This is just a suggestion.
When a method has an out parameter, the calling code has to supply a
target variable. I would like to be able to pass null instead,
indicating that I have no use for the out parameter.
For example, if I have a method ...
bool IsValidWeight(float weight, out string error)
.... I might want to check whether a weight is valid without caring
about the specific error ("value is negative", "value is too high",
etc.), in which case declaring and passing the unused variable seems
to complicate the code unnecessarily.
What do you think?
P.
When a method has an out parameter, the calling code has to supply a
target variable. I would like to be able to pass null instead,
indicating that I have no use for the out parameter.
For example, if I have a method ...
bool IsValidWeight(float weight, out string error)
.... I might want to check whether a weight is valid without caring
about the specific error ("value is negative", "value is too high",
etc.), in which case declaring and passing the unused variable seems
to complicate the code unnecessarily.
What do you think?
P.