-
Notifications
You must be signed in to change notification settings - Fork 0
/
ISerializable.cs
32 lines (29 loc) · 1.04 KB
/
ISerializable.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
namespace Structures.Interface
{
/// <summary>
/// Defines operations used in serialization and deserialization of object
/// </summary>
public interface ISerializable
{
/// <summary>
/// Size of object in bytes
/// </summary>
public int ByteSize { get; }
/// <summary>
/// Serializes object to byte array
/// </summary>
/// <returns>Byte array representation of object</returns>
public byte[] ToByteArray();
/// <summary>
/// Deserializes object from byte array
/// </summary>
/// <param name="array">Array representation of object</param>
/// <param name="offset">Start index in array where deserialization will begin</param>
public void FromByteArray(byte[] array, int offset = 0);
/// <summary>
/// Creates new instance with same type as instance implementing this interface
/// </summary>
/// <returns>New instance with same type</returns>
public ISerializable Clone();
}
}