/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='code'> /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <object> Get1Async(this ISalutations operations, string code, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.Get1WithHttpMessagesAsync(code, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
static void Main(string[] args) { SampleClass sc = new SampleClass(); IControl ctrl = sc; ISurface srfc = sc; // The following lines all call the same method sc.Paint(); ctrl.Paint(); srfc.Paint(); AnotherSampleClass sc2 = new AnotherSampleClass(); IControl ctrl2 = sc2; ISurface srfc2 = sc2; ISalutations slts = sc2; ctrl2.Paint(); srfc2.Paint(); Console.WriteLine(sc2.Greeting); // change something slts.Greeting = "The interface has changed this"; Console.WriteLine(sc2.Greeting); }
/// <summary> /// Initializes client properties. /// </summary> private void Initialize() { this.Entry = new Entry(this); this.Salutations = new Salutations(this); this.BaseUri = new Uri("http://localhost:3884"); SerializationSettings = new JsonSerializerSettings { Formatting = Formatting.Indented, DateFormatHandling = DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = DateTimeZoneHandling.Utc, NullValueHandling = NullValueHandling.Ignore, ReferenceLoopHandling = ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver() }; DeserializationSettings = new JsonSerializerSettings { DateFormatHandling = DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = DateTimeZoneHandling.Utc, NullValueHandling = NullValueHandling.Ignore, ReferenceLoopHandling = ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver() }; }
/// <summary> /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <SalutationCollectionModel> GetAsync(this ISalutations operations, CancellationToken cancellationToken = default(CancellationToken)) { HttpOperationResponse <SalutationCollectionModel> result = await operations.GetWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false); return(result.Body); }
/// <summary> /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> public static SalutationCollectionModel Get(this ISalutations operations) { return(Task.Factory.StartNew(s => ((ISalutations)s).GetAsync(), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='code'> /// </param> public static object Get1(this ISalutations operations, string code) { return(operations.Get1Async(code).GetAwaiter().GetResult()); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> public static object Get(this ISalutations operations) { return(operations.GetAsync().GetAwaiter().GetResult()); }