Method GetPropertySafe
GetPropertySafe(Type?, string, BindingFlags)
Same as GetProperty(string) but doesn't raise exceptions.
public static PropertyInfo? GetPropertySafe(Type? type, string propName, BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public)
Parameters
type
TypeType where to search for the property.
propName
stringProperty name.
bindingFlags
BindingFlagsBinding flags used when property is searched. Optional.