public static string EncodeToString(this ISerializable val) { byte[] encodedBytes = val.SerializeToBytes(); string encodedString = Convert.ToBase64String(encodedBytes); return(encodedString); }