Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Olá,
Possuo uma lista de strings que recebo por javascript através de webmethod.
O detalhe é que esta lista é montada inteiramente pelo clientside, mas não é uma lista qualquer e sim uma lista exata do objeto que preciso, porém em forma de string.
Ex.:
List<string> options = new List<string>()
{
{"new MeuObjeto(\"teste 1\", 10, 12, 50, 70, 0, new System.Drawing.Font(\"Arial\", 10, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point), System.Drawing.Color.Black, false)"},
{"new MeuObjeto(\"teste 2\", 10, 14, 50, 70, 0, new System.Drawing.Font(\"Arial\", 14, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point), System.Drawing.Color.Black, false)"},
{"new MeuObjeto(\"teste 3\", 10, 16, 50, 70, 0, new System.Drawing.Font(\"Arial\", 35, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point), System.Drawing.Color.Black, false)"},
{"new MeuObjeto(\"teste 4\", 10, 18, 50, 70, 0, new System.Drawing.Font(\"Arial\", 10, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point), System.Drawing.Color.Black, false)"},
{"knew MeuObjeto(\"teste 5\", 10, 20, 50, 70, 0, new System.Drawing.Font(\"Arial\", 9, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point), System.Drawing.Color.Black, false)"},
{"new MeuObjeto(\"teste 6\", 10, 22, 50, 70, 0, new System.Drawing.Font(\"Arial\", 10, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point), System.Drawing.Color.Black, false)"}
};
O fato é: como converter estes dados para o objeto (MeuObjeto) que preciso? Já pensei em dynamic, csharpcodeprovider, mandar os objetos separados (os system.drawing) etc.. mas nada funcionou ..
Por gentileza quem souber como resolver agradecerei imensamente.
Carregando comentários...