Creates a Directory subscription for the given subject, with the specified parameter settings.
![](../icons/collapse_all.gif)
C# | Visual Basic | Visual C++ |
IDirectorySubscription CreateDirectorySubscription( IDirectorySubscriptionListener listener, string subject, IDirectorySubscriptionParameters parameters )
Function CreateDirectorySubscription ( _ listener As IDirectorySubscriptionListener, _ subject As String, _ parameters As IDirectorySubscriptionParameters _ ) As IDirectorySubscription
IDirectorySubscription^ CreateDirectorySubscription( IDirectorySubscriptionListener^ listener, String^ subject, IDirectorySubscriptionParameters^ parameters )
![](../icons/collapse_all.gif)
- listener (IDirectorySubscriptionListener)
- The listener that will receive events relating to the subscribed directory.
- subject (String)
- The name of the directory (for example “/MSFT”).
- parameters (IDirectorySubscriptionParameters)
- The directory subscription parameters. To obtain an IDirectorySubscriptionParameters object, first obtain the IParametersFactory associated with the IStreamLinkProvider. Then call the CreateDirectorySubscriptionParameters()()() method on the IParametersFactory. This call will return a valid IDirectorySubscriptionParameters object.
![](../icons/collapse_all.gif)
A new directory subscription.
![](../icons/collapse_all.gif)
Note: Directories do not presently require any parameters,
so this variant of the CreateDirectorySubscription() method is functionally identical to
the method that applies default parameter settings (CreateDirectorySubscription(IDirectorySubscriptionListener, String) ),
provided the IDirectorySubscriptionParameters supplied in parameters
is obtained from the IParametersFactory.
![](../icons/collapse_all.gif)
![](../icons/CopyCode.gif)
using System; using Caplin.StreamLink; using Caplin.StreamLink.Authentication; using Caplin.StreamLink.Subscription.Directory; namespace StreamLinkExamples.Directory { /// <summary> /// Example of how to create a directory subscription using parameters. /// </summary> public class CreateDirectorySubscriptionWithParameters { /// <summary> /// Creates a simple directory subscription with no parameters. /// </summary> public static void CreateADirectorySubscriptionWithParametersExample() { // Set up StreamLink and login credentials StreamLink myStreamLink = new StreamLink(); myStreamLink.CredentialsProvider = new PasswordCredentialsProvider("admin", "admin"); // Finally, connect to the Liberator myStreamLink.StreamLinkProvider.Connect(); // Set up listener and created the subscription for /DEMO IDirectorySubscriptionListener listener = new ExampleDirectorySubscriptionListener(); IDirectorySubscriptionParameters parameters = myStreamLink.StreamLinkProvider.ParametersFactory.CreateDirectorySubscriptionParameters(); IDirectorySubscription subscription = myStreamLink.StreamLinkProvider.CreateDirectorySubscription(listener, "/DEMO", parameters); // Subscribe the subscription, this will be queued until we // login to the Liberator subscription.Subscribe(); } } }