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
class IpV6 | |
{ | |
private readonly string _originalValue; | |
public IpV6(string aValue) | |
{ | |
_originalValue = aValue; | |
} | |
public string Compress() |
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
internal static DateTime RoundToNearestMinuteUtc(this DateTimeOffset dt) | |
{ | |
var diff = 0; | |
var minute = TimeSpan.FromMinutes(1); | |
var result = (double)(dt.Ticks % minute.Ticks) / minute.Ticks; | |
if (result >= 0.5) | |
{ | |
diff = 1; | |
} |
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
namespace Example | |
{ | |
/// <summary> | |
/// HTTP defines a set of request methods to indicate the desired action to be performed for a given resource. | |
/// Although they can also be nouns, these request methods are sometimes referred to as HTTP verbs. | |
/// Each of them implements a different semantic, but some common features are shared by a group of them: e.g. a request method can be safe, idempotent, or cacheable. | |
/// | |
/// <see cref="https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods"/> | |
/// </summary> | |
public static class HttpVerb |
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
public sealed class Example : IEquatable<Example> | |
{ | |
public Example(string content) | |
{ | |
Content = content; | |
} | |
public string Content { get; } | |
public bool Equals(Example other) |
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
public delegate object ConstructorDelegate(); | |
public ConstructorDelegate GetConstructor(string typeName) | |
{ | |
var type = Type.GetType(typeName); | |
var ctor = type.GetConstructor(new Type[0]); | |
var methodName = type.Name + "Ctor"; | |
var dynamicMethod = new DynamicMethod(methodName, type, new Type[0], typeof(Activator)); | |
var ilgen = dm.GetILGenerator(); |
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
internal enum Foo | |
{ | |
Bar = 0 | |
} | |
internal struct MyStuct : IEquatable<MyStuct> | |
{ | |
private static readonly EqualityComparer<Foo> Eq = EqualityComparer<Foo>.Default; | |
public MyStuct(Foo foo) |
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
npm list -g --depth=0 :: Show list of the globally installed packages with their version |
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
public int[] InsertSort(int[] array) | |
{ | |
for (int i = 1; i < array.Length; i++) | |
{ | |
int j = i; | |
while ((j > 0) && (array[j] < array[j - 1])) | |
{ | |
int tmp = array[j - 1]; | |
array[j - 1] = array[j]; | |
array[j] = tmp; |
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; | |
namespace DotNetPlayground | |
{ | |
public class Product : ICloneable | |
{ | |
public string Name { get; set; } | |
public float Price { get; set; } |
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; | |
namespace DataStructures | |
{ | |
public class Stack<T> | |
{ | |
#region Fields | |
private int _count; | |
private T[] _values; |
NewerOlder