Skip to content

Instantly share code, notes, and snippets.

View karthikchintala1's full-sized avatar

Karthik Chintala karthikchintala1

View GitHub Profile
using System;
using System.Collections.Generic;
using System.Data;
using System.Dynamic;
using System.Linq;
using System.Linq.Expressions;
public class Program
{
static void Main(string[] args)
public void M(string x)
{
if (!(x == "a"))
{
if (!(x == "b"))
{
if (x == "c")
{
Console.WriteLine("c value");
}
.method public hidebysig
instance void M (
string x
) cil managed
{
// Method begins at RVA 0x2050
// Code size 73 (0x49)
.maxstack 2
IL_0000: ldarg.1
public void M(string x)
{
switch(x)
{
case "a":
Console.WriteLine("a value");
break;
case "b":
Console.WriteLine("b value");
break;
public async Task DoSomeThingAsync()
{
var time = Stopwatch.StartNew();
//a database call which takes 5 seconds to run
//await Task.Delay(5000);
//await PerformCalculationsAsync();
Task t1 = Task.Delay(5000);
Task t2 = PerformCalculationsAsync();
public class Program
{
static void Main(string[] args)
{
AwaitTest at = new AwaitTest();
at.DoSomeThingAsync().GetAwaiter().GetResult();
}
}
public class AwaitTest
{
public async Task DoSomeThingAsync()
{
var time = Stopwatch.StartNew();
//a database call which takes 5 seconds to run
await Task.Delay(5000);
await PerformCalculationsAsync();
@karthikchintala1
karthikchintala1 / todo.component.ts
Created September 10, 2017 13:04
the todo component
import { Component, ViewChild } from '@angular/core';
import { TodoListComponent } from './todolist.component';
@Component({
selector: 'app-todo',
template: `
<div>
<input type="text" placeholder="add a todo item here" [(ngModel)]="todotext"/>
<input type="submit" (click)="addItem()" value="Add Todo" />
</div>
import { Component, Input } from '@angular/core';
@Component({
selector: 'app-todo-list',
template: `
<div>
<ul>
<li *ngFor="let item of todoList">
<input type="checkbox" [checked]="item.done" [(ngModel)]="item.done"/>
<span [style.textDecoration] = "item.done ? 'line-through' : ''">{{ item.name }}</span>
@karthikchintala1
karthikchintala1 / todo.component.ts
Created September 5, 2017 13:56
Initial todo item for todo app
import { Component } from '@angular/core';
@Component({
selector: 'app-todo',
template: `
<div>
<input type="text" placeholder="add a todo item here" [(ngModel)]="todotext"/>
<input type="submit" (click)="addItem()" value="Add Todo" />
</div>
`