GetPublicInstanceProperties() public méthode

public GetPublicInstanceProperties ( ) : IEnumerable
Résultat IEnumerable
 private object CreateObjectFromArguments(IEnumerable<KeyValuePair<string,string>> parsedArguments, Parameter paramInfo)
 {
     var obj = Activator.CreateInstance(paramInfo.ParameterType);
     foreach (
         PropertyInfo prop in paramInfo.GetPublicInstanceProperties())
     {
         var recognizedArgument = parsedArguments.First(a => a.Key.EqualsIC(prop.Name));
         prop.SetValue(obj, ConvertFrom(recognizedArgument, prop.PropertyType), null);
     }
     return obj;
 }
Exemple #2
0
 private void AddArgumentWithOptionsForPropertiesOnObject(List<Argument> recognizers, Parameter parameterInfo)
 {
     recognizers.AddRange(parameterInfo.GetPublicInstanceProperties()
         .Select(prop =>
             new Argument(prop.Name,
                 required: parameterInfo.LooksRequired() && IsRequired(prop),
                 type: prop.PropertyType)));
 }