Hash table, ShortedList , Namespace
1. Hash table - It is used to store data in particular
key.
. Hash table
display data in random format.
Prog
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections;
namespace proghashtb
{
class Program
{
static void Main(string[] args)
{
Hashtable h1 = new Hashtable();
// insert element in
hashtable
h1.Add("101","nagpur");
h1.Add("102", "pune");
h1.Add("103", "mumbai");
h1.Add("104", "Goa");
foreach(string k in h1.Keys)
{
Console.WriteLine(k + " " + h1[k]);
}
Console.ReadKey();
}
}
}
2.shortedList:-
* Arranges
data in specify order.
* It is used
to pair the object method.
* All paired
object is used (<…>).
* Paired object is used for
dynamic variable.(using var keyword).
* Shorted
list is used as keyconcept.
Prog:-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections;
namespace progshortedlist
{
class Program
{
static void Main(string[] args)
{
SortedList<int, string> st = new SortedList<int, string>();
//inserted element in
sorted list
st.Add(3,"ngp");
st.Add(1, "pune");
st.Add(2,"goa");
Console.WriteLine("After arranging element");
foreach( var k in st)
{
Console.WriteLine(k.Key + " " + k.Value);
}
Console.ReadKey()
; }
}
}
# Namespace:-
* Namespace
is a collection of class.
Ex.
Class student
Class
employee
Class
admission
Class college
Class account
Class company
Block college
(admission,student, account)
Block
comnpany (company,emp)
Prog
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace prognamespace
{
namespace college
{
class student
{
public void display()
{
Console.WriteLine("wel");
}
}
class exam
{
public void show ()
{
Console.WriteLine("come");
}
}
}
class Program
{
static void Main(string[] args)
{
// how to create object
college.student
s2 = new college.student();
college.exam e1
= new college.exam();
s2.display();
e1.show();
Console.ReadKey();
}
}
}
Task 1 :-
implementation of transeffring data between 2 namespace.
Task 2:-
shorted and hash table into user input.
Comments
Post a Comment