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 Microsoft.VisualStudio.TestTools.UnitTesting; | |
namespace NETCoreTests | |
{ | |
[TestClass] | |
public class TestClass | |
{ | |
[TestMethod] | |
public void TestMethodPass() | |
{ |
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 Microsoft.Extensions.Logging; | |
namespace ConsoleApplication | |
{ | |
public class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
var logFactory = new LoggerFactory() |
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
foreach (var item in collection) | |
{ | |
DoSomething(item); | |
} |
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
Stopwatch stopWatch = new Stopwatch(); | |
stopWatch.Start(); | |
foreach (var item in collection) | |
{ | |
DoSomething(item); | |
} | |
stopWatch.Stop(); |
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) | |
{ | |
RunStopwatch(() => | |
{ | |
foreach (var item in collection) | |
{ | |
DoSomething(item); | |
} | |
}); | |
} |
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
//----------------------------------------------------------------------- | |
// <copyright file="Benchmark.cs" company="YuGuan Corporation"> | |
// Copyright (c) YuGuan Corporation. All rights reserved. | |
// </copyright> | |
//----------------------------------------------------------------------- | |
namespace DevLib.Diagnostics | |
{ | |
using System; | |
using System.Diagnostics; | |
using System.Diagnostics.CodeAnalysis; |
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.Threading; | |
using DevLib.Diagnostics; | |
namespace ConsoleApplication4 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Benchmark.Run(i => |
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; | |
namespace ConsoleApplication4 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
// Want to detect which build is used | |
Console.WriteLine(BuildConfiguration.IsDebug ? "Debug" : "Release"); |
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
/// <summary> | |
/// Convert Image to Icon. | |
/// </summary> | |
/// <param name="image">The source image.</param> | |
public static Icon ConvertToIcon(Image image, bool nullTonull = false) | |
{ | |
if (image == null) | |
{ | |
if (nullTonull) | |
{ |
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; | |
namespace System.Runtime.CompilerServices | |
{ | |
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly)] | |
public sealed class ExtensionAttribute : Attribute | |
{ | |
} | |
} |