Common string class.

  • Thread starter Thread starter Todd Clarkston
  • Start date Start date
T

Todd Clarkston

Okay, I am sure this question has been asked here before, but to all
of the Object Oriented Guru's, please shed some light on a simple
question. What is the best practice for creating a common text
object? For example, I have a table named "User" that has a column
named FIRST_NAME; I would like to access the string value of the
column name using something like:

Constants.UserTable.FirstName or UserTable.ColumnNames.FirstName

where the "FirstName" property of these examples would be set/equal to
the value of "FIRST_NAME".

Quick final example, instead of using:

string firstName = row["FIRST_NAME"].ToString();

I would like to use something like:

string firstName = row[UserTable.ColumnNames.FirstName].ToString();

Is it better to create nested classes (which I use now), or is there a
better OOP way to accompish this task? Any help is greatly
appreciated!

Thank you,

Todd
 
sounds overly complicated.....

are these tables, rows and columns objects instances of the .Net framework
classes in the System.Data namespace, if so you can do

string firstValue = row[0].ToString();
string secondValue = row[1].ToString();

etc...

what is wrong with that?

HTH

Ollie
 
Back
Top