4
I would like to get the properties of my Parents object, but I would not like to take the property (States) of my Country class. I tried it the way it is in the "Test" class and I couldn’t because I didn’t know the Type that is the Ienumerable.
There would be some other way to not just bring this property by performing a generic condition, because I can’t put the name of the Property, because this is a process that will be used for all my entity class, and I need to ignore all properties that are of type Ienumerable.
public partial class Teste
{
Pais pais = new Pais();
PropertyInfo[] properties = pais .GetType().GetProperties().Select(x =>
x.PropertyType != typeof(IEnumerable<T>));
}
public partial class Pais : EntityBase
{
public Pais() : base()
{
this.Estados = new HashSet<Estado>();
}
public override string TableName { get { return "PAIS"; } }
public override int Handle { get; set; }
public string Nome { get; set; }
public string Sigla { get; set; }
public virtual ICollection<Estado> Estados { get; set; }
public override DateTime DataCadastro { get; set; }
public override string UsuarioCadastro { get; set; }
public override DateTime? DataAlteracao { get; set; }
public override string UsuarioAlteracao { get; set; }
}
Okay, but what is the criterion of what should take or not. The question has no way of knowing. It seems that the name
Estados
is not the criterion, so what is it? What is the expected result?– Maniero
Then I reopen, people are kicking things that you can’t tell if this is it, so each one gives a solution that doesn’t produce the same result except by coincidence.
– Maniero
She did put the guy who wants her exclusion is Ienumerable ...
– novic
For me this question is very clear, there is no reason to be marked as pending...
– Tiago S
For me it is not. It is ambiguous, when this problem is solved we can reopen.
– Maniero