Skip to main content
.NET Framework Class Library
ConfigurationElementSerializeElement Method

Writes the contents of this configuration element to the configuration file when implemented in a derived class.

Namespace:   System.Configuration
Assembly:  System.Configuration (in System.Configuration.dll)
Syntax
Protected Friend Overridable Function SerializeElement ( _
	writer As [%$TOPIC/ms134137_en-us_VS_110_1_0_0_0_0%], _
	serializeCollectionKey As [%$TOPIC/ms134137_en-us_VS_110_1_0_0_0_1%] _
) As [%$TOPIC/ms134137_en-us_VS_110_1_0_0_0_2%]
protected internal virtual [%$TOPIC/ms134137_en-us_VS_110_1_0_1_0_0%] SerializeElement(
	[%$TOPIC/ms134137_en-us_VS_110_1_0_1_0_1%] writer,
	[%$TOPIC/ms134137_en-us_VS_110_1_0_1_0_2%] serializeCollectionKey
)
protected public:
virtual [%$TOPIC/ms134137_en-us_VS_110_1_0_2_0_0%] SerializeElement(
	[%$TOPIC/ms134137_en-us_VS_110_1_0_2_0_1%]^ writer, 
	[%$TOPIC/ms134137_en-us_VS_110_1_0_2_0_2%] serializeCollectionKey
)
abstract SerializeElement : 
        writer:[%$TOPIC/ms134137_en-us_VS_110_1_0_3_0_0%] * 
        serializeCollectionKey:[%$TOPIC/ms134137_en-us_VS_110_1_0_3_0_1%] -> [%$TOPIC/ms134137_en-us_VS_110_1_0_3_0_2%]  
override SerializeElement : 
        writer:[%$TOPIC/ms134137_en-us_VS_110_1_0_3_0_3%] * 
        serializeCollectionKey:[%$TOPIC/ms134137_en-us_VS_110_1_0_3_0_4%] -> [%$TOPIC/ms134137_en-us_VS_110_1_0_3_0_5%]

Parameters

writer
Type: System.XmlXmlWriter

The XmlWriter that writes to the configuration file.

serializeCollectionKey
Type: SystemBoolean

true to serialize only the collection key properties; otherwise, false.

Return Value

Type: SystemBoolean
true if any data was actually serialized; otherwise, false.
Exceptions
ExceptionCondition
ConfigurationErrorsException

The current attribute is locked at a higher configuration level.

Examples

The following example shows how to extend the SerializeElement method.

Protected Overrides Function SerializeElement(ByVal writer _
    As System.Xml.XmlWriter, _
    ByVal serializeCollectionKey As Boolean) As Boolean 

    Dim ret As Boolean = _
        MyBase.SerializeElement(writer, serializeCollectionKey)
    ' Enter your custom processing code here. 
    Return ret
End Function 'SerializeElement
protected override bool SerializeElement(
    System.Xml.XmlWriter writer, 
    bool serializeCollectionKey)
{
    bool ret = base.SerializeElement(writer, 
        serializeCollectionKey);
    // You can enter your custom processing code here. 
    return ret;

}
Version Information

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Platforms

Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.