Skip to content

Instantly share code, notes, and snippets.

View Lahirutech's full-sized avatar

Lanka Rathanyaka Lahirutech

View GitHub Profile
var name='lanka'
const express=require('express');
const app= express();
app.get('/',(req,res)=>{
res.send('<h1>Welcome to Express</h1>')});
const PORT=process.env.PORT||5000;
app.listen(PORT,()=>console.log(`server Started on port ${PORT}`));
GET /chat HTTP/1.1
Host: example.com:8000
Origin:client.chat.com
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Key: DSFEW%$#^%%*DGHBD
Sec-WebSocket-Protocol:
Sec-WebSocket-Version: 13
Sec-WebSocket-Extensions:deflate-stream
HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: DSFEW%$#^%%*DGHBD
Sec-WebSocket-Protocol:
Sec-WebSocket-Extensions:deflate-stream
using System.Collections;
var myArrayList = new ArrayList();
// Add elements using .Add() Method
var myArrayList = new ArrayList();
myArrayList.Add(123);
myArrayList.Add("Freelancingcult.com");
myArrayList.Add(5.963);
// adding elements using object initializer syntax method
var myAraylist2 = new ArrayList()
{
"Culure", 452, " ", true, 4.5, null
var myArrList = new ArrayList();
var myArrList2 = new ArrayList(){1, "Bill", " ", true, 4.5, null};
int[] arr = { 150, 200, 300, 400 };
Queue myQ = new Queue();
myQ.Enqueue("Hello");
myQ.Enqueue("World!");
arlist1.AddRange(myArrList2); //adding arraylist in arraylist 
arlist1.AddRange(arr); //adding array in arraylist 
arlist1.AddRange(myQ); //adding Queue in arraylist
var myarray = new ArrayList()
{
1,
"Bill",
300,
4.5f
};
//Access individual item using indexer
int firstElement = (int) myarray[0]; //returns 1
ArrayList arlist = new ArrayList()
{
1,
"Bill",
300,
4.5F
};
foreach (var item in arlist)
Console.Write(item + ", "); //output: 1, Bill, 300, 4.5,
ArrayList arlist = new ArrayList()
{
1,
"Bill",
300,
4.5f
};
arlist.Insert(2, "Third Item");