Class SerializationUtils
Provides misc serialization-related functions that are really low-level and not intended to be used by developers. Methods are thread-safe
Inheritance
Inherited Members
Namespace: Azos.Serialization
Assembly: Azos.dll
Syntax
public static class SerializationUtils
Methods
FindSerializationAttributedMethods(Type, Type)
Finds methods decorated by [On(De)Seriali(zing/zed)]
Declaration
public static List<MethodInfo> FindSerializationAttributedMethods(Type t, Type atype)
Parameters
Type | Name | Description |
---|---|---|
System.Type | t | A type whose methods to search |
System.Type | atype | Attribute type to search |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<System.Reflection.MethodInfo> | List(MethodInfo) that qualifies or NULL if none found |
GetISerializableCtorInfo(Type)
Returns .ctor(SerializationInfo, StreamingContext) that complies with ISerializable concept, or null.
Declaration
public static ConstructorInfo GetISerializableCtorInfo(Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type |
Returns
Type | Description |
---|---|
System.Reflection.ConstructorInfo |
GetNodeByPath(JSONDataMap, String[])
Navigates through JSON datamap by subsequent node names.
Declaration
public static object GetNodeByPath(this JSONDataMap json, params string[] nodeNames)
Parameters
Type | Name | Description |
---|---|---|
JSONDataMap | json | |
System.String[] | nodeNames |
Returns
Type | Description |
---|---|
System.Object | null if navigation path is not exists. JSONDataMap if navigation ends up with non-leaf node. object if navigation ends up with leaf node. |
GetSerializableFields(Type)
Gets all serializable fields for type in parent->child declaration order, sub-ordered by case within the segment
Declaration
public static IEnumerable<FieldInfo> GetSerializableFields(Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Reflection.FieldInfo> |
InvokeSerializationAttributedMethods(List<MethodInfo>, Object, StreamingContext)
Calls method in the list that was returned by a call to FindSerializationAttributedMethods
Declaration
public static void InvokeSerializationAttributedMethods(List<MethodInfo> methods, object instance, StreamingContext streamingContext)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<System.Reflection.MethodInfo> | methods | list that was returned by a call to FindSerializationAttributedMethods |
System.Object | instance | Instance to invoke methods on |
System.Runtime.Serialization.StreamingContext | streamingContext | Streaming Context |
MakeNewObjectInstance(Type)
Create new object instance for type, calling default ctor
Declaration
public static object MakeNewObjectInstance(Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type |
Returns
Type | Description |
---|---|
System.Object |
WalkArrayRead<T>(Array, Func<T>)
Performs an action on each element of a possibly multidimensional array
Declaration
public static void WalkArrayRead<T>(Array arr, Func<T> each)
Parameters
Type | Name | Description |
---|---|---|
System.Array | arr | |
System.Func<T> | each |
Type Parameters
Name | Description |
---|---|
T |
WalkArrayWrite(Array, Action<Object>)
Performs an action on each element of a possibly multidimensional array
Declaration
public static void WalkArrayWrite(Array arr, Action<object> each)
Parameters
Type | Name | Description |
---|---|---|
System.Array | arr | |
System.Action<System.Object> | each |