asp.net mvc - Parsing proprety info C# -


guys i've following loop, , if list i've loop again, until here i'm okay, inside loop got problem, because i've loop not in "propretyinfo", i've loop in object of propretyinfo , values, i've tried hard parse here :

(list<itemdemescla>)objeto.getvalue(objeto, null) 

but throwing excepetion, idea how parse , works?

foreach (propertyinfo objeto in processo.gettype().getproperties()) {     corpoemail += criarlinhaemail(objeto.name, convert.tostring(objeto.getvalue(processo, null)), false);      if (objeto.propertytype.isgenerictype && (objeto.propertytype.getgenerictypedefinition() == typeof(system.collections.generic.list<>)))     {         list<itemdemescla> itensmescla = (list<itemdemescla>)objeto.getvalue(objeto, null);         foreach (itemdemescla item in itensmescla)         {             tabelasaux.add(criartabelainternaemail<itemdemescla>(item, objeto.name));         }     } } 

the error stack:

    @ system.reflection.runtimemethodinfo.checkconsistency(object target)    @ system.reflection.runtimemethodinfo.invokeargumentscheck(object obj, bindingflags invokeattr, binder binder, object[] parameters, cultureinfo culture)    @ system.reflection.runtimemethodinfo.invoke(object obj, bindingflags invokeattr, binder binder, object[] parameters, cultureinfo culture)    @ system.reflection.runtimepropertyinfo.getvalue(object obj, bindingflags invokeattr, binder binder, object[] index, cultureinfo culture)    @ system.reflection.runtimepropertyinfo.getvalue(object obj, object[] index)    @ sacg.services.integracao.integracao.utils.montarcorpoemail[t](t processo, string mensagem) in c:\projetos\cotrijal\branch\1.8.0.0\cotrijal\servicos\sacg.services.integracao\integracao\utils.cs:line 176    @ sacg.services.integracao.integracao.utils.enviaremail[t](t processo, int32 codigodaunidade, string mensagem, string assunto) in c:\projetos\cotrijal\branch\1.8.0.0\cotrijal\servicos\sacg.services.integracao\integracao\utils.cs:line 114    @ sacg.services.integracao.integracao.integracaodaexpedicao.salvarexpedicao(expedicaograos expedicaodto, usuario usuariologado) in c:\projetos\cotrijal\branch\1.8.0.0\cotrijal\servicos\sacg.services.integracao\integracao\integracaodaexpedicao.cs:line 111    @ sacg.services.integracao.expedicaodegraos.registrarexpedicao(expedicaograos expedicao) in c:\projetos\cotrijal\branch\1.8.0.0\cotrijal\servicos\sacg.services.integracao\expedicaodegraos.asmx.cs:line 104 

try getting value of object, instead of propertyinfo:

(list<itemdemescla>)objeto.getvalue(processo, null) 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -