This file contains 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
// Intel(R) Core(TM) i7-2600 CPU @ 3.40 GHz 3.40 GHz | |
// 16 GB RAM, Windows 7, 64 bit | |
// | |
//No cast:0.854751600000001 +- 0.182965645566156ms | |
//Cast:0.724137 +- 0.148216330378943ms | |
// Conclusion: Cast is indeed faster, but remember that we are talking here about _miliseconds_ | |
// for 1000 enumerations of an enum with 1000 elements. First verify whether this is really significant in your code, before | |
// proceeding with micro-optimizations. | |
// Context: http://stackoverflow.com/a/105402/2642204 |
This file contains 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.Diagnostics; | |
using System.Linq; | |
using System.Runtime.CompilerServices; | |
using Serilog; | |
using Serilog.Configuration; | |
using Serilog.Core; | |
using Serilog.Events; | |
namespace ConsoleApp24 |
This file contains 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.Runtime.CompilerServices; | |
namespace Walterlv.Threading | |
{ | |
/// <summary> | |
/// 表示一个可等待对象,如果一个方法返回此类型的实例,则此方法可以使用 `await` 异步等待。 | |
/// </summary> | |
/// <typeparam name="TAwaiter">用于给 await 确定返回时机的 IAwaiter 的实例。</typeparam> | |
public interface IAwaitable<out TAwaiter> where TAwaiter : IAwaiter | |
{ |