using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
public static void Main()
public static void linqquery()
int[] lstdata = Enumerable.Range(1,100).ToArray();
var querydata= lstdata.Where(s=>s%3==0);
foreach(int i in querydata)
Console.Write(i.ToString()+ " ");
public static void MyWhere()
List<int> lstdata= new List<int>();
var querydata= lstdata.MyWhere(s=>s%3==0);
foreach(int i in querydata)
Console.Write(i.ToString()+ " ");
public static void MyWhereNot()
List<int> lstdata= new List<int>();
var querydata= lstdata.MyWhereNot(s=>s%2!=0);
foreach(int i in querydata)
Console.Write(i.ToString()+ " ");
public static void CollectionForDictionary()
Dictionary<int,string> lstdata= new Dictionary<int,String>();
lstdata.Add(i,i.ToString());
var querydata= lstdata.MyWhere(s=>s.Key%3==0);
foreach(KeyValuePair<int,string> i in querydata)
Console.Write(i.Key.ToString()+ " ");
public static void linkedListExample()
CustomLinkedList<int> l1 = new CustomLinkedList<int>();
CustomLinkedList<int> l2 = new CustomLinkedList<int>();
CustomLinkedList<int> l3 = new CustomLinkedList<int>();
CustomLinkedList<int> l4 = new CustomLinkedList<int>();
CustomLinkedList<int> basenode=l3;
Console.Write(basenode.data.ToString()+ " ");
Console.Write(basenode.data.ToString()+ " ");
basenode=basenode.previous;
public static void genericstack()
CustomStack<int> stack=new CustomStack<int>(2);
Console.WriteLine(stack.Pop());
Console.WriteLine(ex.Message);
public static void NotifyProperty()
Person person = new Person();
person.PropertyChanged+=PropertyEventHandler;
public static void PropertyEventHandler(Object source, PropertyChangedEventArgs args)
Console.WriteLine(args.PropertyName);
public static async void runTaskAtEnterval()
Console.WriteLine("runTaskAtEnterval start...");
Console.WriteLine("runTaskAtEnterval End...");
public static void ExecuteTask()
Console.WriteLine("ExecuteTask");
public class Person : INotifyPropertyChanged
private string _lastName;
public event PropertyChangedEventHandler PropertyChanged;
protected void NotifyPropertyChange([CallerMemberName]string PropertyName="")
if(PropertyChanged!=null)
PropertyChanged(this, new PropertyChangedEventArgs(PropertyName));
public class CustomStack<T>
public CustomStack():this(100)
public CustomStack(int size)
datastack = new T[_size];
throw new StackOverflowException("Over flow");
datastack[++pointer]=data;
throw new InsufficientExecutionStackException("Under flow");
return datastack[pointer--];
public class CustomLinkedList<T>
public CustomLinkedList<T> previous;
public CustomLinkedList<T> next;
public static class Extension
public static ICollection<T> MyWhere<T>(this ICollection<T> source, Predicate<T> predicate)
ICollection<T> collection= new Collection<T>();
foreach(T data in source)
public static ICollection<T> MyWhereNot<T>(this ICollection<T> source, Predicate<T> predicate)
ICollection<T> collection= new Collection<T>();
foreach(T data in source)