![]() | Download Help (Windows Only) |
Serves as the base class for all VISA session objects.
Namespace: NationalInstruments.VisaNS
Assembly: NationalInstruments.VisaNS (in NationalInstruments.VisaNS.dll) Version: 13.0.40.167
Visual Basic (Declaration) |
---|
Public Class Session _ Inherits MarshalByRefObject _ Implements IDisposable, ISynchronizeCallbacks, ISupportSynchronizationContext |
C# |
---|
public class Session : MarshalByRefObject, IDisposable, ISynchronizeCallbacks, ISupportSynchronizationContext |
![]() | Note: In the .NET interface to NI-VISA, a VISA session opens when Session or one of its subclasses is instantiated. A VISA session closes when Session or one of its subclasses is disposed by calling the Dispose method. Ensure that you call Dispose when you are finished with a session. |
You cannot read from or write to an instrument or interface if you instantiate Session directly. Instead, you must instantiate one of the Session subclasses directly or indirectly. If you need functionality that is not specific to a hardware interface, you can instantiate MessageBasedSession or RegisterBasedSession directly. However, it is recommended that you instantiate a session indirectly with Open. This method returns the appropriate subclass instance automatically depending on the resource string that you pass as a parameter. The subclass instance is referenced by a generic Session object reference, but you can cast to the more specific type if you need the behavior.
![]() | Note: In some cases, callbacks and event handlers are executed in a different thread than the rest of the program. Therefore, you must take special care when accessing objects that have thread affinity, such as UI controls, from these callbacks and event handlers. For more information, refer to Events, Callbacks, and Thread Safety in Measurement Studio .NET Class Libraries. |
All members of this type are safe for multithreaded operations.
NationalInstruments.VisaNS Namespace
Helpful
Not Helpful