本文整理汇总了C#中JsonServiceClient.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# JsonServiceClient.Dispose方法的具体用法?C# JsonServiceClient.Dispose怎么用?C# JsonServiceClient.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JsonServiceClient
的用法示例。
在下文中一共展示了JsonServiceClient.Dispose方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static void Main(string[] args)
{
JsonServiceClient client = new JsonServiceClient("http://127.0.0.1:8888/");
client.Timeout = TimeSpan.FromSeconds(60);
client.ReadWriteTimeout = TimeSpan.FromSeconds(60);
client.DisableAutoCompression = true;
int success = 0, error = 0;
Parallel.For(0, 100, i => {
try
{
Console.WriteLine(i.ToString());
StatesResult result = client.Get(new GetLastStates());
if(result.List.Count < 4000)
error++;
Console.WriteLine("Received " + result.List.Count + " items");
success++;
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
error++;
}
});
Console.WriteLine(string.Format("Test completed. Success count:{0}; Error count:{1}",success,error));
client.Dispose();
}
示例2: GetMarketData_All_Fields
public void GetMarketData_All_Fields()
{
// Arrange
var client = new JsonServiceClient(_webServiceUrl);
var request = new GetMarketData();
request.DataSource = "GOOG";
request.Ticker = "NASDAQ_TSLA";
request.From = new DateTime(2000, 01, 01, 00, 00, 00);
request.To = new DateTime(2014, 01, 01, 00, 00, 00);
request.RowsNumber = 300;
request.Timeframe = TimeframeType.DAILY;
request.Transformation = TransformationType.RDIFF;
request.SortOrder = SortOrderType.DESC;
request.ExcludeHeaders = false;
request.SpecificColumnNumber = null;
// Act
var response = client.Get(request);
client.Dispose();
// Assert
Assert.True(response.Data.Any());
}