Asp.Net 反射计数属性

Asp.Net Reflection Count properties

我正在使用 ASP.NET 网络服务,但我在通过反射遍历 foreach 属性时遇到问题 我选择向我发送 Web 服务的结果并开始调整并开始在那里寻找与我想要的名称实际匹配的结果(在我的例子中,一条记录) 问题是在尝试 GetType() 时。 GetProperties()returns我"Can Read, Can Write"属性而不是我的属性 这是一个代码:

Resultado = ExpService.getAllExpedients(Valor, FechaInicial, FechaFinal, ExpedienteInicial, ExpedienteFinal, true);
                CountExpedients = Resultado.Expedient.Count<ExpDetail>();
                ViewState["CountExpedients"] = CountExpedients;

如果我直接看字符串 属性 returns 我是对的

var Info = Resultado.Expedient[i].Nif.ToString();

但我不知道如何从这里执行循环来收集所有属性及其值

All Properties 我尝试使用多种形式(包括 GetValue (this, null)),但无论如何都没有成功,这是我完成这部分项目的最后一件事。 有没有人愿意向我解释如何做?

我找到了解决整个问题的方法 我攻击了另一种方法,我有 returns 文件并选择它成功所以

var Detalles = ExpService.getExpDetail(NºExpediente, Valor);
foreach (PropertyInfo Info in Detalles.GetType().GetProperties())
                {
                    if (Info.GetValue(Detalles, null) != null) 
                    {
                        var Informacion = Info.GetValue(Detalles, null).ToString();
                    }
                }