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
typeTypeType where to search for the property.
propNamestringProperty name.
bindingFlagsBindingFlagsBinding flags used when property is searched. Optional.