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
[HideColumns("Error", "StdDev", "Median", "RatioSD")] | |
[Config(typeof(Config))] | |
public class StringReverseBench | |
{ | |
public List<string> List; | |
public IEnumerable<string> Enumerable; | |
[Params(true, false)] // Arguments can be combined with Params | |
public bool UseList; |
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
[MemoryDiagnoser] | |
[SimpleJob(RuntimeMoniker.Net80)] | |
public class StringSegmentVsStringSplitter | |
{ | |
private const string Phrase = "A quick brown fox jumps over the lazy dog dog ."; | |
private static readonly char[] SingleSpace = new char[] { ' ' }; | |
[Benchmark] | |
public int StringSegmentTest() | |
{ |
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
[MemoryDiagnoser] | |
[SimpleJob(RuntimeMoniker.Net60)] | |
public class EnumToString | |
{ | |
public enum SomeValue | |
{ | |
Value1, | |
Value2, | |
Value3 | |
} |
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 class EventData | |
{ | |
public string Message { get; set; } | |
} | |
[MemoryDiagnoser] | |
[SimpleJob(RuntimeMoniker.Net472, baseline: true)] | |
[SimpleJob(RuntimeMoniker.Net60)] | |
public class GetPropertyBench | |
{ |
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
[MemoryDiagnoser] | |
public class DictionaryAddOrUpdate | |
{ | |
ConcurrentDictionary<int, int> cd = new ConcurrentDictionary<int, int>(); | |
ConcurrentDictionary<int, int> cd1 = new ConcurrentDictionary<int, int>(); | |
[Benchmark] | |
public void WithoutAllocation() | |
{ | |
var value = 5; |
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
[TestMethod] | |
[DataRow(new[] { 1, 2, 3 })] | |
[DataRow(new[] { 1, 3, 2 })] | |
public void Test1(int[] inputOrder) | |
{ | |
var foo = new Foo(); | |
var fooWrapper = new FooWrapper(); | |
var threads = new[] | |
{ | |
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.Threading; | |
public class Foo { | |
private int _currentStep; | |
public void First(Action printFirst) | |
{ | |
// printFirst() outputs "first". Do not change or remove this line. | |
printFirst(); | |
Interlocked.Increment(ref _currentStep); |
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
import {BrowserModule} from '@angular/platform-browser'; | |
import {NgModule} from '@angular/core'; | |
import {AppRoutingModule} from './app-routing.module'; | |
import {AppComponent} from './app.component'; | |
import {FormsModule} from '@angular/forms'; | |
import {HTTP_INTERCEPTORS, HttpClientModule} from '@angular/common/http'; | |
import {JwtInterceptor} from './interceptors/jwt.interceptor'; | |
import {HttpErrorInterceptor} from './interceptors/http-error.interceptor'; |
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
import {Injectable} from '@angular/core'; | |
import {ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot} from '@angular/router'; | |
import {AuthenticationService} from '../shared/services/authentication.service'; | |
@Injectable({providedIn: 'root'}) | |
export class AuthGuard implements CanActivate { | |
constructor( | |
private router: Router, |
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
import { NgModule } from '@angular/core'; | |
import { Routes, RouterModule } from '@angular/router'; | |
import {AuthGuard} from './guards/app.guard'; | |
const routes: Routes = [ | |
{path: '', redirectTo: 'dashboard', pathMatch: 'full'}, | |
{path: 'dashboard', loadChildren: './modules/dashboard/dashboard.module#DashboardModule', canActivate: [AuthGuard]}, | |
{path: 'auth', loadChildren: './modules/login/login.module#LoginModule'}, | |
{path: '**', redirectTo: 'dashboard', pathMatch: 'full'} | |
]; |
NewerOlder