how do I create my own custom ToString() format
<p>I would like to specify the format of the tostring format, but I am not sure of the best way to handle this.</p>

<p>for example if I hand the following specifiers</p>

<p>EE = equipment</p>

<p>ED = equipment description</p>

<p>EI = equipment Id</p>

<p>so that if I used the tostring as such:</p>

<pre><code>.ToString("EE-EI (ED)")
</code></pre>

<p>the output might be:</p>

<pre><code> "CAT994-61 (Front end loader)"
</code></pre>

<p>would the best way be to search for the substrings and do a token replacement?</p>

<p>does any one have an example of doing this?</p>

<p>Thanks</p>

<p>So Far....</p>

<pre><code>public class Equipment
{
string _EquipIntID;
public string EquipIntID
{
  get { return _EquipIntID; }
}

string _EquipID;
public string EquipID
{
  get { return _EquipID; }
}

string _EquipDescription;
public string EquipDescription
{
  get { return _EquipDescription; }
}

string _CategoryID;
public string CategoryID
{
  get { return _CategoryID; }
}

string _Notes;
public string Notes
{
  get { return _Notes; }
}

string _DepartID;
public string DepartID
{
  get { return _DepartID; }
}

public Equipment(string equipIntId, string equipId, string equipDescription, string categoryId, string notes, string departmentId)
{
  _EquipIntID = equipIntId;
  _EquipID = equipId;
  _EquipDescription = equipDescription;
  _CategoryID = categoryId;
  _Notes = notes;
  _DepartID = departmentId;
}
public string ToString(string format)
{
  string output = format;
  output = output.Replace("EE", _EquipID);
  output = output.Replace("ED", _EquipDescription);
  output = output.Replace("DI", _DepartID);
  return output; 
}
public override string ToString()
{
    return _EquipID;
}
}
</code></pre>

<p>the above works nicely</p>
