This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class FooService | |
| { | |
| private readonly IServiceScopeFactory _scopeFactory; | |
| public FooService( IServiceScopeFactory scopeFactory ) | |
| { | |
| _scopeFactory = scopeFactory; | |
| } | |
| public void DoSomething() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static async Task Main(string[] args) | |
| { | |
| args = new string[] { "ARGUMENT1" };//test | |
| if (args != null && args.Length > 0) | |
| { | |
| var task = args[0]; | |
| if (task == "ARGUMENT1") | |
| { | |
| var form = new SerializerForm(); | |
| try |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class AzureBlobFileClient : IFileClient | |
| { | |
| private CloudBlobClient _blobClient; | |
| public AzureBlobFileClient(string connectionString) | |
| { | |
| var account = CloudStorageAccount.Parse(connectionString); | |
| _blobClient = account.CreateCloudBlobClient(); | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| namespace ConsoleApp19 | |
| { | |
| static class Program | |
| { | |
| static void Main( string[] args ) | |
| { | |
| var lst = new List<int> { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private static async Task<decimal> LongRunningOperationWithCancellationTokenAsync( int loop, CancellationToken cancellationToken ) | |
| { | |
| // We create a TaskCompletionSource of decimal | |
| var taskCompletionSource = new TaskCompletionSource<decimal>(); | |
| // Registering a lambda into the cancellationToken | |
| cancellationToken.Register( () => | |
| { | |
| // We received a cancellation message, cancel the TaskCompletionSource.Task | |
| taskCompletionSource.TrySetCanceled(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Foo | |
| { | |
| public string GetValue() | |
| { | |
| return @"start of text | |
| { | |
| with some lines | |
| } | |
| end of text"; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static void Main(string[] args) | |
| { | |
| var cts = new CancellationTokenSource(); | |
| var token = cts.Token; | |
| var queryTask = QueryWebServiceInLoop("http://webapi/endpoint", token) | |
| .ContinueWith(t => | |
| { | |
| if (t.Status == TaskStatus.Faulted) | |
| Console.WriteLine("faulted."); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Castle.Windsor; | |
| using System; | |
| namespace SimpleWindsorTest | |
| { | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| var container = new WindsorContainer(); |