Re: Classes concepts
From: Josema (Jestrade_at_ocu.org)
Date: 09/28/04
- Next message: Nicholas Paldino [.NET/C# MVP]: "Re: String Manipulation Alternatives to RegEx"
- Previous message: Ignacio Machin \( .NET/ C# MVP \): "Re: Classes concepts"
- In reply to: Nicholas Paldino [.NET/C# MVP]: "Re: Classes concepts"
- Next in thread: Ignacio Machin \( .NET/ C# MVP \): "Re: Classes concepts"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 28 Sep 2004 05:39:03 -0700
Okay, i will take a look for this Class
Thnx Nicholas.
"Nicholas Paldino [.NET/C# MVP]" wrote:
> Josema,
>
> For what you are trying to do, I think there are some better ways to do
> it. First, the class name should be Department, and not department.
>
> For the collection class, I would derive from CollectionBase, and in
> ..NET 2.0, I would use the List<T> class to represent the collection of
> department.
>
> However, I wouldn't even do this at all. In the end, I would use typed
> data sets set up in the IDE and use those. It would provide the easiest
> access for the data, as well as offering that grouping into collections that
> you need.
>
> Hope this helps.
>
>
> --
> - Nicholas Paldino [.NET/C# MVP]
> - mvp@spam.guard.caspershouse.com
>
>
> "Josema" <Jestrade@ocu.org> wrote in message
> news:80223DC9-B942-463D-A802-D177210E0BA7@microsoft.com...
> > Hi to all,
> >
> > actually im a newbie in the OOP and i would like to know if this way of
> > using clases its a best way (logical, and a good way)
> >
> > Lets imagine that i have a data base with departments (depid, depname)
> >
> > if i make the class
> >
> > public class department
> > {
> > private int id;
> > private string name;
> >
> > public int ID
> > {
> > get{return id;}
> > set{id=value;}
> > }
> > public string Name
> > {
> > get{return name;}
> > set{name=value;}
> > }
> > }
> >
> > like which I want is to create a class for each department i make another
> > class:
> >
> > public class departments
> > {
> > private department[] ListofDepartments;
> >
> > public departments()
> > {
> > //Imagine that i have a datatable with all the query (select * from
> > departments)
> > ListofDepartments=new departament[datatable.rows.count];
> > //Imagine that i make a loop = for i=0 to rows into the datatable
> > ListofDepartments[i]=new Department()
> > //assing into the ListofDepartments[i].ID and Name the values of the
> > datatable
> > }
> > }
> >
> > Its this a good way to create this?,
> >
> > Could you put me an example about wich methods could be implemented in the
> > department class (the first)
> >
> >
> > Thanks a lot
> > Regards.
> > Josema
>
>
>
- Next message: Nicholas Paldino [.NET/C# MVP]: "Re: String Manipulation Alternatives to RegEx"
- Previous message: Ignacio Machin \( .NET/ C# MVP \): "Re: Classes concepts"
- In reply to: Nicholas Paldino [.NET/C# MVP]: "Re: Classes concepts"
- Next in thread: Ignacio Machin \( .NET/ C# MVP \): "Re: Classes concepts"
- Messages sorted by: [ date ] [ thread ]