Powershell offers a ValidateScript
parameter attribute to check given attributes. Example:
function foo{
Param(
[ValidateScript({Test-Path $_ -PathType Leaf})]
[string]
$FilePath,
....
Is there an equivalent available in C#, to validate parameters of a method? So that I can define a method in c# like:
...
public static string Foo (
[Validate(p => p <1)]
int p) {
...
}