C# Mapping List to Private Class Variables (Character Stats)

How can I map each element of _CharacterRow (a List) to each private var in CharObject (a class)?
I assume I’ll need to dynamically build a List out of the private elements of CharOject but how can this be done?
Also, is this the way I should be going about this?

I’m aware I can propbably save a lot of time and effort by simply using a List within CharObject instead of idividual variables, but I’m not sure it would result in the effect I want.

Below are detailes for better understanding.

I have a List I call _CharacterRow. This stores information about a character for example:

_CharacterRow[0] = 1
_CharacterRow[1] = MyCharName
_CharacterRow[2] = 0
_CharacterRow[3] = 0
_CharacterRow[4] = 0-0-0-0

The elements of this list represent the following:
id
name
currentHP
maxHP
items

items is a string containing ids separated by “-”'s. My client recognizes these ids after being split to populate an inventory.

Now here’s where I can use the help. I have a CharObject class that I want this data to be stored in. As it stands now, all the variables are separate and represent an element of the List _CharacterRow.

Again, for example:

public class CharObject
{	
    private int _id;
    private string _name;
    private Stat _hp;
    private sting _items;

    // Public Get/Set functions for each var below...
}

Notice the Stat type of _hp. Stat looks as follows:

public class Stat
{
	private int _current;
	private int _max;
	private int _temp;

	// Public Get/Set functions for each var below...
}

So, the real problem is that MySQL/PHP isn’t giving you a data structure. Ideally, there would be some C# hooks to enable it to do that (but my last database use was through .ASP.)

You might be able to convert that string into a “streamString” (a C++ concept – a string treated as a file) and then convince your Stat data structure to read from it using Serialization.

But, you generally want to “touch” each item as you add it to the Stat structure. Calculating manna from willpower, loading the model for their weapon, adding up weights for carried items… . It’s generally understood that inside the read/write/assign class member functions is the one place where all the specific, ugly, vaguely hackish bits are consolidated.

I’m not sure why they are even in an array (why not read them right from the file into Stats?,) but given you have thr array, just write a Stats member function to convert:

public void initFromArray(string[] D) {
  if(D.Length!=5) { someErrorMsg }
  name = D[0];
  wisdom = Convert.ToInt32(D[1]);
    ...
}