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 static System.Net.HttpStatusCode; | |
internal static class Extensions | |
{ | |
internal static string AsString(this HttpStatusCode status) => status switch | |
{ | |
Continue => nameof(Continue), | |
SwitchingProtocols => nameof(SwitchingProtocols), | |
Processing => nameof(Processing), | |
EarlyHints => nameof(EarlyHints), |
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
internal sealed class Logger : ILogger | |
{ | |
private readonly FileStream _writer = new FileStream(Config.Configuration["LogFile"], FileMode.Create, FileAccess.Write, | |
FileShare.None, 1024, FileOptions.SequentialScan); | |
private readonly UTF8Encoding _utf = new UTF8Encoding(true); | |
private readonly byte[] _line; | |
internal Logger() => _line = _utf.GetBytes(Environment.NewLine); |
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
([system.reflection.assembly]::loadfile("")).FullName |
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; | |
using System.Linq.Expressions; | |
using System.Reflection; | |
internal sealed class PropertySetter<T> | |
{ | |
private const BindingFlags Flags = BindingFlags.Public | BindingFlags.Instance | BindingFlags.IgnoreCase; | |
private readonly Type _type = typeof(T); |
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
string[] arr = { "orange", "nest", "apple", "ABC","xyz", "bana", "cat"}; | |
for (int i = 0; i < arr.Length; i++) | |
{ | |
for (int j = i + 1; j < arr.Length; j++) | |
{ | |
if (arr[i]?.CompareTo(arr[j]) > 0) | |
{ | |
var temp = arr[j]; | |
arr[j] = arr[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
//Interlocked class Provides atomic operations for variables that are shared by multiple threads. | |
private static string _data; | |
public ActionResult Index() | |
{ | |
//Compares two instances of the specified reference type <paramref name="T" /> for equality and, if they are equal, replaces the first one | |
if (Interlocked.CompareExchange(ref _data, "test", null) == null) | |
{ |
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.Concurrent; | |
namespace FeatureFlagTest | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var home = new HomeController(FeatureFactory.Feature); |
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 static class TypeActivator<T> | |
{ | |
private delegate T Activator<T>(params object[] args); | |
private static readonly Dictionary<string, Activator<T>> _items = new Dictionary<string, Activator<T>>(); | |
/// <summary> | |
/// | |
/// </summary> | |
/// <returns></returns> | |
public static T Create() |
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
//main.go | |
package main | |
import ( | |
"fmt" | |
"time" | |
"awesomeProject/another" | |
) | |