Exemplo n.º 1
0
 /// <summary>
 /// Safely return Value of the desired Element.  This relieves the need to check
 /// for ethe existence or null value of the required element.
 /// </summary>
 /// <param name="element">The Containing element element</param>
 /// <param name="index">Zero based index of the element required</param>
 /// <returns>A string represenation of the hl7 field.</returns>
 public static string ElementValue(this HL7Element element, int index)
 {
     return((element == null) ? null :
            (index == -1) ? element.ToString() :
            (index == 0 && element.Count == 0) ? element.Value :
            (element.Count > index) ? element[index].ToString() : "");
 }