나는 기본 모델에 System.Drawing.Color
를 추가 할 필요가 있지만, 그 값은 읽기 전용, 그래서 나는 다음을 수행하려고에 대한 :InvalidOperationException이 때 SetFactory 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);
내가 얻을 :
InvalidOperationException : Operation is not valid due to the current state of the object