public static MappedAccessor <MockObject> CreateAccessor(MemoryMap map, long sizeInBytes) { return(map.CreateVariable <MockObject>(sizeInBytes, new MemoryMap.ReadFromDelegate <MockObject>( (Stream stream, long position, ref MockObject value) => { var payload = string.Empty; var size = MemoryMapDelegates.ReadFromString(stream, position, ref payload); value = new MockObject(payload); return size; }), new MemoryMap.WriteToDelegate <MockObject>( (Stream stream, long position, ref MockObject value) => { var payload = value.Payload; return MemoryMapDelegates.WriteToString(stream, position, ref payload); }))); }
public static MappedAccessor<MockObject> CreateAccessor(MemoryMap map, long sizeInBytes) { return map.CreateVariable<MockObject>(sizeInBytes, new MemoryMap.ReadFromDelegate<MockObject>( (Stream stream, long position, ref MockObject value) => { var payload = string.Empty; var size = MemoryMapDelegates.ReadFromString(stream, position, ref payload); value = new MockObject(payload); return size; }), new MemoryMap.WriteToDelegate<MockObject>( (Stream stream, long position, ref MockObject value) => { var payload = value.Payload; return MemoryMapDelegates.WriteToString(stream, position, ref payload); })); }