automatic properties in vs2005???

  • Thread starter Biranchi Narayan Panda
  • Start date
B

Biranchi Narayan Panda

is it possible in .net framework 2.0 to create a class that can server the
purpose of List<> ?

eg.

A class Job that has empno, ename etc. I want to get data from database in
form of List<Job> and bind it to gridView. The problem is that I'm using
VS2005 and I'll not be able to upgrade.


So, what modification do I need to make to the following class to server the
above purpose--


//automatic property of .net framework 3.0
public class Job
{
public int empno{get; set}
public string ename{get; set}
}


I want to make a class in .NET framework 2.0 that will help me to create
object of Job and List<Job>, bind with gridview and etc.

please assist.
 
S

Scott M.

If you asking about Generics, .NET 2.0 (and VS 2005) supports it, so you
don't need to upgrade.

Not sure what your question is relating to automatic properties.

Can you be more clear? If you simply make a job class, then you can have a
List<Job> with no additional code.

-Scott
 
S

sloan

using System.Collections.Generic;



That is a VS2005-available (Framework version 2.0 or with add-ins,
Framework version 3.0).

I've went with this slight habit now

public class JobCollection : System.Collections.Generic.List<Job>
{ /* Yep, that's it! */ }


So I have future-proofed myself if I need to encapsulate any methods on the
JobCollection.

//automatic property of .net framework 3.0

That is a C# 3.0 feature.....not a "Framework" feature.
http://www.lmgtfy.com/?q=c#+3.0+automatic+properties




Now, if you're really bored then you can start down this rabbit trail:
http://www.danielmoth.com/Blog/2007/05/using-c-30-from-net-20.html
I have not went down that rabbit trail..........so you're on your own there.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,071
Latest member
MetabolicSolutionsKeto

Latest Threads

Top