Skip to content

Instantly share code, notes, and snippets.

Avatar

Mike-E Mike-E-angelo

View GitHub Profile
@Mike-E-angelo
Mike-E-angelo / CSharpish.cs
Last active Jun 12, 2019
Razor C# Example
View CSharpish.cs
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.RenderTree;
namespace Presentation.Elements
{
public abstract class ElementBase : ComponentBase
{
readonly string _name;
protected ElementBase(string name) => _name = name;
View BasicAsynchronousInterface.cs
public interface IHelloWorldAsync
{
Task<string> SayHelloAsync(string message);
}
View BasicInterface.cs
public interface IHelloWorld
{
string SayHello(string message);
}
@Mike-E-angelo
Mike-E-angelo / Empty
Last active Sep 8, 2018
Hashing out Empty
View Empty
// Re: https://medium.com/@antao.almada/enumeration-in-net-iii-enumerable-empty-t-1bfcd53739a7
// Decompiled with JetBrains decompiler
// Type: System.Linq.Enumerable
// Assembly: System.Linq, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// MVID: 27FAC526-A042-4B73-AEC3-616A6586AC97
// Assembly location: c:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.1.3\System.Linq.dll
namespace System.Linq
{
@Mike-E-angelo
Mike-E-angelo / MetricTonOfCode.cs
Created Apr 15, 2018
Xunit2 Demystify Support
View MetricTonOfCode.cs
[assembly: TestFramework("AssemblyName.Namespace.TestFramework", "AssemblyName")]
public sealed class TestFramework : XunitTestFramework
{
public TestFramework(IMessageSink messageSink) : base(messageSink) {}
protected override ITestFrameworkExecutor CreateExecutor(AssemblyName assemblyName)
=> new Executor(assemblyName, SourceInformationProvider, DiagnosticMessageSink);
}
View Murica.cs
namespace Government
{
class America { }
class Citizen : America
{
const string TaxReturns = "Release us FFS!!!";
private int trumpEmotionalIQ = 0, trumpTolerance = 0;
private float trumpExperience = .03f;
@Mike-E-angelo
Mike-E-angelo / ImplicitCastingBenchmarks.cs
Created Apr 13, 2017
Basic benchmarks around implicit/explicit contra/covariant casting.
View ImplicitCastingBenchmarks.cs
using BenchmarkDotNet.Attributes;
namespace ClassLibrary1
{
public class ImplicitCastingBenchmarks
{
readonly private IInterface<string> _sut = new Implementation();
readonly private IInterface<object> _obj;
public ImplicitCastingBenchmarks()
{
@Mike-E-angelo
Mike-E-angelo / CastingBenchmarks.cs
Created Apr 12, 2017
Basic benchmarks on casting, including with access from a dictionary.
View CastingBenchmarks.cs
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using BenchmarkDotNet.Attributes;
namespace ClassLibrary1
{
public class CastingBenchmarks
{
readonly private static Type Key = typeof(int);