Skip to content

Instantly share code, notes, and snippets.

View Lahirutech's full-sized avatar

Lanka Rathanyaka Lahirutech

View GitHub Profile
var students = new List<Student>() {
new Student(){ Id = 1, Name="Bill"},
new Student(){ Id = 2, Name="Steve"},
new Student(){ Id = 3, Name="Ram"},
new Student(){ Id = 4, Name="Abdul"}
};
//get all students whose name is Bill
var result = from s in students
where s.Name == "Bill"
var numbers = new List<int>(){ 10, 20, 30, 40 };
numbers.Insert(1, 11);// inserts 11 at 1st index: after 10.
foreach (var num in numbers)
Console.Write(num);
/*
10
11
20
var numbers = new List<int>(){ 10, 20, 30, 40, 10 };
numbers.Remove(10); // removes the first 10 from a list
numbers.RemoveAt(2); //removes the 3rd element (index starts from 0)
//numbers.RemoveAt(10); //throws ArgumentOutOfRangeException
foreach (var el in intList)
Console.Write(el); //prints 20 30
var numbers = new List<int>(){ 10, 20, 30, 40 };
numbers.Contains(10); // returns true
numbers.Contains(11); // returns false
numbers.Contains(20); // returns true
@Lahirutech
Lahirutech / test.md
Created June 2, 2021 14:59
Hello World Markdow

Hello World

This is content converted from Markdown!

Here's a JSON sample:

{
  "foo": "bar"
}
@Lahirutech
Lahirutech / test.html
Created June 2, 2021 15:00
Hello World Html
<html>
<head>
<style>
h1 {
font-family: Calibri;
}
</style>
</head>
<body>
<h1>Hello World!</h1>
@Lahirutech
Lahirutech / web.config
Created June 8, 2021 18:39
Web config File
<?xml version="1.0"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="React Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
function myFunction(){
alert(“myFunction()”);
}
function testFunction(param1){
param1();
}
testFunction(myFunction);
let name="String parameter"
function myFunction(param1){
console.log(param1)
}
function testFunction(param1){
param1();
}
function doTogether(firstCallback, secondCallback){
firstCallback(); //execute the first function
secondCallback(); //execute the second function
console.log('Fullstack Journey');
}
function LeanFrontEnd() {
console.log('Start with js');
}