Creates a Directory subscription for the given subject.
![](../icons/collapse_all.gif)
C# | Visual Basic | Visual C++ |
IDirectorySubscription CreateDirectorySubscription( IDirectorySubscriptionListener listener, string subject )
Function CreateDirectorySubscription ( _ listener As IDirectorySubscriptionListener, _ subject As String _ ) As IDirectorySubscription
IDirectorySubscription^ CreateDirectorySubscription( IDirectorySubscriptionListener^ listener, String^ subject )
![](../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”).
![](../icons/collapse_all.gif)
A new Directory subscription.
![](../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> /// Examples of how to create an IDirectorySubscription using the /// IStreamLinkProvider interface. /// </summary> public class CreateDirectorySubscriptionBasic { /// <summary> /// Creates a simple directory subscription with no parameters. /// </summary> public static void CreateDirectorySubscriptionBasicExample() { // 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(); IDirectorySubscription subscription = myStreamLink.StreamLinkProvider.CreateDirectorySubscription(listener, "/DEMO"); // Subscribe the subscription, this will be queued until we // login to the Liberator subscription.Subscribe(); } } }