public void GenerateSave(IILGen ilGenerator, Action<IILGen> pushWriter, Action<IILGen> pushCtx, Action<IILGen> pushValue, Type valueType)
{
if (GetPreferedType() != valueType)
throw new ArgumentException("value type does not match my type");
var locValue = ilGenerator.DeclareLocal(_type, "value");
ilGenerator
.Do(pushValue)
.Stloc(locValue);
foreach (var pairi in _fields)
{
var pair = pairi;
var methodInfo = _type.GetProperties().First(p => GetPersitentName(p) == pair.Key).GetGetMethod();
pair.Value.GenerateSaveEx(ilGenerator, pushWriter, pushCtx, il => il.Ldloc(locValue).Callvirt(methodInfo), methodInfo.ReturnType);
}
}