Guruji Point - Code You Want To Write

  • Home
  • Asp.Net
  • WCF
  • SQL
  • Type Script
  • AngularJS
  • Tech News
  • Blog
  • Earn Online

Sunday, 30 July 2017

Difference Between Array And ArrayList In C#

 array in c#, arraylist in c#, C#, Difference array and arrayList, Gurujipoint     No comments   

Introduction
In this article we will learn what is the difference between Array and ArrayList. What are arrays and why do we need array. What are arraylist and why do we need arraylist. how to use arraylist in c#.

Previous Updates

In previous articles we have learnt  Why every business needed digital Marketing  ,What is Lock and how to achieve lock on sql table. Authorization in Asp.Net. How high quality content affects your Website. What is Blocking and Deadlock In SQL. Transaction Commit and Rollback in sql server with example. Top 30 Asp.net interview question

Arrays
Arrays are strongly typed collection of same type of datatype. Arrays are fixed in length , you can not change array length at runtime. Arrays are stores values in indexes and if we need to access the values from array then we have to read the index of array. It is a refrence type datatype.

Declaration and assigning values to Array
string[] strArr=new string[2];
strArr [0] = "Web Development";
strArr [1] = "GurujiPoint";
In this code we declare string type of array having size 2. And assigning values to strArr on 0 and 1 index.


ArrayList
Arraylist are not strongly type collection. Arraylist can store values of same type as well as different data types. It is not fixed in length you can change Arraylist size dynamically. Arraylist is usedSystem.Collection namespace.

Declaration and assigning values to ArrayList
ArrayList objArrList = new ArrayList();
objArrList.Add("welcome"); // Add string values
objArrList.Add(10);   // Add integer values
objArrList.Add(10.05); // Add float values

Difference between Array and ArrayList
Array
ArrayList
Arrays are strong type collection and allow to store fixed length
It is not strong type collection. List size increase or decrease during runtime.
It belongs to System.Array namespace
It belongs to System.Collection namespace
It stores only same type of data
It stores Different types of data.
Use static helper class Array to perform different tasks on the array.
ArrayList itself includes various utility methods for various tasks.

  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Email ThisBlogThis!Share to XShare to Facebook
Newer Post Older Post Home
View mobile version

0 comments:

Post a Comment

Facebook Updates

Guruji Point

Categories

Comman table Expression in SQL Dynamic Grid Row IQueryable in c# Learn AngularJS Scope_Identity() Use of indexes comma seperated string in sql row_number() and dense_rank() salary table structure. while loop in sql why do we need cursor why tuple used

About Us

This blog is about the Programming ,Tech News and some intresting facts related Contents. Here you can find fundamental and expert level topic of programming languages very practically related to C# , Asp.Net ,Sql-Server, JavaScript, Jquery, WebServices And also Web-Api, WCF ,WPF, Angular Js.

Contact Us

Email Us - gurujipoints@gmail.com
Contact- 8077657477

Reach Us

Copyright © Guruji Point - Code You Want To Write