je dois ajouter le System.Drawing.Color
au modèle par défaut, mais ses valeurs sont en lecture seule, donc j'essayé de faire ce qui suit:InvalidOperationException lorsque SetFactory pour RuntimeTypeModel
MetaType colorMeta = RuntimeTypeModel.Default.Add(typeof(Color), true);
MethodInfo methodInfo = typeof(Color).GetMethod("FromArgb", new Type[] { typeof(Int32), typeof(Int32), typeof(Int32), typeof(Int32) });
colorMeta.AddField(1, "A");
colorMeta.AddField(2, "R");
colorMeta.AddField(3, "G");
colorMeta.AddField(4, "B");
colorMeta.SetFactory(methodInfo);
et je reçois:
InvalidOperationException : Operation is not valid due to the current state of the object