本文整理汇总了C#中IObservable.Do方法的典型用法代码示例。如果您正苦于以下问题:C# IObservable.Do方法的具体用法?C# IObservable.Do怎么用?C# IObservable.Do使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IObservable
的用法示例。
在下文中一共展示了IObservable.Do方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Download
public IObservable<StorageObject> Download(IObservable<Activity> input, StorageSession session, String param, IDictionary<String, String> args)
{
IDisposable _ = session.SuppressDispose();
return input
.Do(a => a.Act("Body", ((HttpWebResponse) WebRequest.Create(a.GetValue<String>()).GetResponse()).If(
r => (Int32) r.StatusCode < 300,
r => new Byte[r.ContentLength].Apply(b => r.GetResponseStream().Dispose(s => s.Read(b, 0, b.Length))),
r => new Byte[0]
)))
.Finally(_.Dispose);
}
示例2: Initialize
/// <summary>
/// Initialize message bus
/// </summary>
public void Initialize()
{
// Set the maximum number of concurrent connections
ServicePointManager.DefaultConnectionLimit = 12;
// Create the queue if it does not exist already
AzureServerConnectionString = PinkoConfiguration.GetSetting("Microsoft.ServiceBus.ConnectionString");
//Uri uri = ServiceBusEnvironment.CreateServiceUri("sb", "ingham-blog", string.Empty);
//string name = "owner";
//string key = "abcdefghijklmopqrstuvwxyz";
//TokenProvider tokenProvider = TokenProvider.CreateSharedSecretTokenProvider("pinko-app-bus", "S6c6FYYpdWvOLscjmUyJWQDiQd01gxENzm+W/FSjOk4=");
//NamespaceManager namespaceManager = new NamespaceManager(uri, tokenProvider);
Trace.TraceInformation("Creating AzureNamespaceManager: {0}...", AzureServerConnectionString);
_azureNamespaceManager = NamespaceManager.CreateFromConnectionString(AzureServerConnectionString);
// Set WorkerRole outbound Rx bus
_applicationBusMessageSend = PinkoApplication.GetSubscriber<IBusMessageOutbound>();
// Set listener for outbound messages
_applicationBusMessageSend
.Do(x => Trace.TraceInformation("Sending: {0}", x.Verbose()))
.ObserveOn(Scheduler.ThreadPool)
.Subscribe(x => GetQueue(string.IsNullOrEmpty(x.ReplyTo) ? x.QueueName : x.ReplyTo).Send(x));
}
示例3: Configure
public IObservable<FileSystemChange> Configure(IObservable<FileSystemChange> observable)
{
return observable.Do(Console.WriteLine);
}