Ejemplo n.º 1
0
 /// <summary>
 ///     Traverses a serializable object graph using an IObjectVisitor implementation.
 /// </summary>
 /// <typeparam name="T">graph type.</typeparam>
 /// <param name="visitor">visitor implementation.</param>
 /// <param name="graph">input graph.</param>
 public static void VisitObject <T>(IObjectVisitor visitor, T graph)
 {
     FSP.VisitObject <T>(visitor, graph);
 }
Ejemplo n.º 2
0
 /// <summary>
 ///     Compute size in bytes for given value.
 /// </summary>
 /// <typeparam name="T">input value type.</typeparam>
 /// <param name="value">input value.</param>
 /// <returns></returns>
 public static long ComputeSize <T>(T value)
 {
     return(FSP.ComputeSize <T>(value));
 }
Ejemplo n.º 3
0
 /// <summary>
 ///     Computes an 128-bit MurMur3 hash for given value.
 /// </summary>
 /// <typeparam name="T">input value type.</typeparam>
 /// <param name="value">input value.</param>
 /// <returns>128-bit hashcode.</returns>
 public static HashResult ComputeHash <T>(T value)
 {
     return(FSP.ComputeHash <T>(value));
 }
Ejemplo n.º 4
0
 /// <summary>
 ///     Checks if given type is serializable.
 /// </summary>
 /// <param name="type">input type.</param>
 public static bool IsSerializableType(Type type)
 {
     return(FSP.IsSerializableType(type));
 }
Ejemplo n.º 5
0
 /// <summary>
 ///     Checks if given type is serializable.
 /// </summary>
 /// <typeparam name="T">input type.</typeparam>
 public static bool IsSerializableType <T>()
 {
     return(FSP.IsSerializableType <T>());
 }
Ejemplo n.º 6
0
        /// <summary>
        ///     Performs an in-memory, deep cloning of provided serializable object graph.
        ///     Cloning is performed on a node-to-node basis and does not make use of intermediate
        ///     serialization buffers.
        /// </summary>
        /// <typeparam name="T">graph type.</typeparam>
        /// <param name="graph">object to be cloned.</param>
        /// <param name="streamingContext">payload object for StreamingContext; defaults to null.</param>
        /// <returns>Clone of provided object graph.</returns>
        public static T Clone <T>(T graph, Object streamingContext = null)
        {
            var sc = Utils.GetStreamingContext(streamingContext);

            return(FSP.Clone <T>(graph, streamingContext: sc));
        }
Ejemplo n.º 7
0
 /// <summary>
 ///     Traverses the object graph, returning if serializable
 ///     or raising an exception if not.
 /// </summary>
 /// <typeparam name="T">Type of the object graph to be checked.</typeparam>
 /// <param name="graph">Graph to be checked.</param>
 public static void EnsureSerializable <T>(T graph)
 {
     FSP.EnsureSerializable <T>(graph);
 }
Ejemplo n.º 8
0
 bool ISerializer.CanSerialize(Type value)
 {
     return(FsPickler.IsSerializableType(value));
 }
Ejemplo n.º 9
0
 bool ISerializer.CanSerialize <T>()
 {
     return(FsPickler.IsSerializableType <T>());
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Declares that types satisfying the provided predicate should be treated
 /// by FsPickler as carrying the Serializable attribute.
 /// </summary>
 /// <param name="predicate">Predicate that decides whether type should be serializable.</param>
 public static void DeclareSerializable(Predicate <Type> predicate)
 {
     FSP.DeclareSerializable(predicate.ToFSharpFunc());
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Declares that supplied type is to be treated as serializable.
 /// This is equivalent to dynamically attaching a SerializableAttribute to the type.
 /// </summary>
 /// <param name="type">Type to be declared serializable</param>
 public static void DeclareSerializable(Type type)
 {
     FSP.DeclareSerializable(type);
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Declares that supplied type is to be treated as serializable.
 /// This is equivalent to dynamically attaching a SerializableAttribute to the type.
 /// </summary>
 /// <typeparam name="T">Type to be declared serializable.</typeparam>
 public static void DeclareSerializable <T>()
 {
     FSP.DeclareSerializable <T>();
 }