private static DynamicMethod CreateSizeOfMethod(Type itemType, Module module) { var method = new DynamicMethod("SizeOf", typeof(int), null, module, true); ILGenerator emit = method.GetILGenerator(); emit .@sizeof(itemType) .ret(); return(method); }