how to use generic list in c#

Posted by Gow.Net under C# on 3/5/2012 | Points: 10 | Views : 21700 | Status : [Member] | Replies : 8
how to use generic list in c# please any one explain with example

gowthaman8870226416


Responses

Posted by: CGN007 on: 3/5/2012 [Member] Silver | Points: 25

Up
0
Down
The following resource should be helpful
http://www.csharp-station.com/Tutorials/Lesson20.aspx

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Naraayanan on: 3/5/2012 [Member] Starter | Points: 25

Up
0
Down
Hi,
Check this link
http://www.codeproject.com/Articles/38447/Generic-List-C

Regards,
Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/
http://abaprocker.blogspot.com/

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gow.Net on: 3/6/2012 [Member] Starter | Points: 25

Up
0
Down

hi Naraayanan sir
sir i already Refer that link i can't understand can u please explain with one example

gowthaman8870226416

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hmanjarawala on: 3/6/2012 [Member] Bronze | Points: 25

Up
0
Down
Hi,

http://msdn.microsoft.com/en-us/library/ms379564%28v=vs.80%29.aspx
http://www.dotnetperls.com/list
http://www.akadia.com/services/dotnet_generics.html

Himanshu Manjarawala
Sr. Software Engineer@AutomationAnywhere
http://fieredotnet.wordpress.com/

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Patel28rajendra on: 3/13/2012 [Member] Starter | Points: 25

Up
0
Down
Hi

Plz see this Link here its explained in easy language


http://www.dotnetfunda.com/articles/article152.aspx

Thanks
Rajendra Patel

R D Patel

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sksamantaray on: 3/13/2012 [Member] Silver | Points: 25

Up
0
Down
Hi ,
Hope this link will help you.
http://www.dotnetfunda.com/tutorials/videos/x99-csharpnet-interview-questions-what-are-generics.aspx

Thanks,
Sanjay

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Mahesh_Chs on: 3/14/2012 [Member] Starter | Points: 25

Up
0
Down
class clsGeneric1
{
//declaration of a generic method
static void Display<g>(g s)
{
Console.WriteLine("value is=" + s);
}

static void Main(string[] args)
{
Display<string>("welcome");
Display<int>(10);
Display<double>(10.5);
Console.Read();
}
}

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sajeev_M87 on: 12/11/2012 [Member] Starter | Points: 25

Up
0
Down
public List<lEntity> selectEntry(Entity)
{

if (con.State == ConnectionState.Closed)
{
con.Open();
}
SqlCommand command = new SqlCommand("sp_proc", con);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.AddWithValue("@transid", obect_Entity.Transid);
List<lEntity> objEntities = new List<Entity>();
try
{
SqlDataReader sqlDataReader = command.ExecuteReader();
while (sqlDataReader.Read())
{
AccessoryPurchaseBillEntity obj = new AccessoryPurchaseBillEntity();

if (!Convert.IsDBNull(sqlDataReader["transid"]))
obj.Transid = sqlDataReader.GetString(sqlDataReader.GetOrdinal("transid"));

if (!Convert.IsDBNull(sqlDataReader["receiveqty"]))
{
try
{
obj.ReceiveQty = float.Parse(sqlDataReader["receiveqty"].ToString());
}

catch (Exception e) { obj.ReceiveQty = 0; }

}


objEntities.Add(obj);

}
}
catch (Exception e)
{

}
finally
{
con.Close();

}
return objEntities;
}

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response