Show / Hide Table of Contents

Class DataWriter

The base class for classes that implement sequential data writing.

Inheritance
System.Object
DataWriter
JsonDataWriter
XmlDataWriter
Implements
IDataWriter
System.IDisposable
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Terrasoft.Common
Assembly: Terrasoft.Common.dll
Syntax
public abstract class DataWriter : IDataWriter, IDisposable

Constructors

DataWriter()

Declaration
protected DataWriter()

Fields

SerializableObjectTypeFullNamePropertyName

The full type name of the serializable object, which includes the type namespace but not includes the assembly name.

Declaration
public const string SerializableObjectTypeFullNamePropertyName = "TypeFullName"
Field Value
Type Description
System.String

SerializableObjectValuePropertyName

Name of the property/attribute containing the value of the serializable object.

Declaration
public const string SerializableObjectValuePropertyName = "Value"
Field Value
Type Description
System.String

Methods

Close()

Closes the current instance DataWriter.

Declaration
public abstract void Close()

Dispose()

Declaration
public void Dispose()

Dispose(Boolean)

Declaration
protected abstract void Dispose(bool disposing)
Parameters
Type Name Description
System.Boolean disposing

WriteFinishCollection()

Ends recording the current collection.

Declaration
public abstract void WriteFinishCollection()

WriteFinishObject()

Finishes writing the item to the output stream.

Declaration
public abstract void WriteFinishObject()

WriteRawValue(String, Object)

Write the raw value to property.

Declaration
public abstract void WriteRawValue(string name, object value)
Parameters
Type Name Description
System.String name

Property name.

System.Object value

Raw value.

WriteSerializableObjectValue(String, Object, Object)

Serializes and writes a given object as value.

Declaration
public abstract void WriteSerializableObjectValue(string name, object value, object defValue)
Parameters
Type Name Description
System.String name

Name of the element.

System.Object value

Value.

System.Object defValue

Default value.

WriteStartCollection(String)

Starts recording the collection with the given name.

Declaration
public abstract void WriteStartCollection(string name)
Parameters
Type Name Description
System.String name

The name of the collection.

WriteStartObject()

Writes the root element to the output stream.

Declaration
public abstract void WriteStartObject()

WriteStartObject(String)

Writes the root element with the specified name to the output stream.

Declaration
public abstract void WriteStartObject(string name)
Parameters
Type Name Description
System.String name

The name of the root element.

WriteValue(Object[])

Writes a given array of values.

Declaration
public abstract void WriteValue(params object[] values)
Parameters
Type Name Description
System.Object[] values

An array of values.

Remarks

Overloaded method.

WriteValue(String, Boolean, Boolean)

Writes the value of an element with a given name and a given default value (for boolean values).

Declaration
public abstract void WriteValue(string name, bool value, bool defValue)
Parameters
Type Name Description
System.String name

Name of the element.

System.Boolean value

The value of an element of type System.bool.

System.Boolean defValue

The default value for the item.

Remarks

Overloaded method.

WriteValue(String, DateTime, DateTime)

Writes the value of an element with a given name and a given default value (for DateTime values).

Declaration
public abstract void WriteValue(string name, DateTime value, DateTime defValue)
Parameters
Type Name Description
System.String name

Name of the element.

System.DateTime value

The value of an element of type System.DateTime.

System.DateTime defValue

The default value for the item.

Remarks

Overloaded method.

WriteValue(String, Decimal, Decimal)

Writes the value of an element with a given name and a given default value (for decimal values).

Declaration
public abstract void WriteValue(string name, decimal value, decimal defValue)
Parameters
Type Name Description
System.String name

Name of the element.

System.Decimal value

The value of an element of type System.decimal.

System.Decimal defValue

The default value for the item.

Remarks

Overloaded method.

WriteValue(String, Double, Double)

Writes the value of an element with a given name and a given default value (for double values).

Declaration
public abstract void WriteValue(string name, double value, double defValue)
Parameters
Type Name Description
System.String name

Name of the element.

System.Double value

The value of an element of type System.double.

System.Double defValue

The default value for the item.

Remarks

Overloaded method.

WriteValue(String, Enum, Enum)

Writes the value of an element with a given name and a given default value (for enum values).

Declaration
public abstract void WriteValue(string name, Enum value, Enum defValue)
Parameters
Type Name Description
System.String name

Name of the element.

System.Enum value

The value of an element of type System.Enum.

System.Enum defValue

The default value for the item.

Remarks

Overloaded method.

WriteValue(String, Guid, Guid)

Writes the value of an element with a given name and a given default value (for guid values).

Declaration
public abstract void WriteValue(string name, Guid value, Guid defValue)
Parameters
Type Name Description
System.String name

Name of the element.

System.Guid value

The value of an element of type System.Guid.

System.Guid defValue

The default value for the item.

Remarks

Overloaded method.

WriteValue(String, Int32, Int32)

Writes the value of an element with a given name and a given default value (for int values).

Declaration
public abstract void WriteValue(string name, int value, int defValue)
Parameters
Type Name Description
System.String name

Name of the element.

System.Int32 value

The value of an element of type System.Int32.

System.Int32 defValue

The default value for the item.

Remarks

Overloaded method.

WriteValue(String, Stream)

Writes the value of the element with the given name and the values ​​from the specified stream.

Declaration
public abstract void WriteValue(string name, Stream value)
Parameters
Type Name Description
System.String name

Name of the element.

System.IO.Stream value

The stream from which the recording is made.

Remarks

Overloaded method.

WriteValue(String, String, String)

Writes the value of an element with a given name and a given default value (for string values).

Declaration
public abstract void WriteValue(string name, string value, string defValue)
Parameters
Type Name Description
System.String name

Name of the element.

System.String value

The value of an element of type System.String.

System.String defValue

The default value for the item.

Remarks

Overloaded method.

WriteValue(String, Type, Object, Object)

Writes the value of an element with a given name and a given default value, converted to the specified type.

Declaration
public abstract void WriteValue(string name, Type valueType, object value, object defValue)
Parameters
Type Name Description
System.String name

Name of the element.

System.Type valueType

Value type.

System.Object value

Value.

System.Object defValue

Default value.

Remarks

Overloaded method.

WriteValue(String, DataConverter, Object, Object)

Writes the value of an element with a given name and a given default value, transformed in accordance with the specified type of transformation.

Declaration
public abstract void WriteValue(string name, DataConverter converter, object value, object defValue)
Parameters
Type Name Description
System.String name

Name of the element.

DataConverter converter

Transformation type.

System.Object value

Value.

System.Object defValue

Default value.

Remarks

Overloaded method.

WriteValue(String, LocalizableString, LocalizableString)

Writes the value of an element with a given name and a given default value (for localizable string values).

Declaration
public abstract void WriteValue(string name, LocalizableString value, LocalizableString defValue)
Parameters
Type Name Description
System.String name

Name of the element.

LocalizableString value

The value of an element of type Terrasoft.LocalizableString.

LocalizableString defValue

The default value for the item.

Remarks

Overloaded method.

Implements

IDataWriter
System.IDisposable

Extension Methods

BaseSerializableObjectUtilities.WriteSerializableObjectValue(DataWriter, String, ISerializableObject)
ReflectionUtilities.GetPropertyValue(Object, String)
ReflectionUtilities.GetPropertyDefValue(Object, String, Object)
ReflectionUtilities.TryGetPropertyValue(Object, String, out Object)
ReflectionUtilities.HasProperty(Object, String)
ReflectionUtilities.GetPropertyValue(Object, String, BindingFlags)
ReflectionUtilities.GetPropertyValueByPath(Object, String)
ReflectionUtilities.SetPropertyValue(Object, String, Object)
ReflectionUtilities.TrySetPropertyValue(Object, String, Object)
ValidateUtilities.CheckArgumentNull(Object, String)
ValidateUtilities.CheckDependencyNull(Object, String)
ValidateUtilities.EnsureDependencyNotNull<T>(T, String)
DataWriterUtils.Write(IDataWriter, String, String)
DataWriterUtils.Write(IDataWriter, String, Guid)
DataWriterUtils.Write(IDataWriter, String, Int32)
DataWriterUtils.Write(IDataWriter, String, Boolean)
MetaDataTestUtils.MetaPropertiesShouldNotHaveDefValue<TInstance>(TInstance)
MetaDataTestUtils.MetaPropertiesShouldNotHaveDefValue<TInstance>(TInstance, Boolean)
NSubstituteExtension.Protected(Object, String, Object[])
NSubstituteExtension.Protected(Object, String, Boolean, Object[])
NSubstituteExtension.ProtectedGeneric<T>(Object, String, Object[])
NSubstituteExtension.ProtectedGeneric<T>(Object, String, Boolean, Object[])
NSubstituteExtension.ProtectedProperty(Object, String)
NSubstituteExtension.MatchInstance<T>(T)
SubstituteUtilities.GetIsSubstituteObject(Object)
SubstituteUtilities.Instead<TInstance, TValue>(TInstance, Func<TInstance, TValue>)
Back to top Generated by DocFX