VintaSoft Twain .NET SDK 15.4: Documentation for .NET developer
Vintasoft.WpfTwain Namespace / DeviceCapabilityCollection Class / Save(Stream) Method
Syntax Exceptions Remarks Example Requirements SeeAlso
In This Topic
Save(Stream) Method (DeviceCapabilityCollection)
In This Topic
Saves information about current values of capabilites to the stream.
Syntax
'Declaration

Public Sub Save( _
ByVal stream
Stream to save the current values of capabilities.
As System.IO.Stream _
)
public void Save(
System.IO.Stream stream
)

Parameters

stream
Stream to save the current values of capabilities.
Exceptions
ExceptionDescription
Thrown if stream is null (Nothing in VB).
Thrown if the stream does not support writing.
Thrown if device is in wrong state.
Thrown if device does not support capability.
Thrown if the .NET debugger is used and the function evaluation requires all threads to run.
Remarks

The method ignores the "custom" capabilities, i.e. capabilities, which are added using the Add(UInt16) method.

Example

This C#/VB.NET code shows how to save values of current device capabilities to a file.


''' <summary>
''' Saves the device capability collection to a file.
''' </summary>
Public Shared Sub SaveDeviceCapabilityCollection(device As Vintasoft.Twain.Device)
    ' open the device
    device.Open()
    ' open file
    Using fs As New System.IO.FileStream("scanner-capabilities.xml", System.IO.FileMode.Append, System.IO.FileAccess.Write)
        ' save the device capability collection to a file
        device.Capabilities.Save(fs)
    End Using
End Sub


/// <summary>
/// Saves the device capability collection to a file.
/// </summary>
public static void SaveDeviceCapabilityCollection(Vintasoft.Twain.Device device)
{
    // open the device
    device.Open();
    // open file
    using (System.IO.FileStream fs = new System.IO.FileStream("scanner-capabilities.xml", System.IO.FileMode.Append, System.IO.FileAccess.Write))
    {
        // save the device capability collection to a file
        device.Capabilities.Save(fs);
    }
}

Requirements

Target Platforms: .NET 10; .NET 9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

See Also