/// <summary>
 ///
 /// </summary>
 /// <param name="lvi"></param>
 /// <param name="dv"></param>
 /// <param name="session"></param>
 protected virtual void UpdateTypeInListView(ListViewItem lvi, DataValue dv, Session session)
 {
     if (dv.Value != null)
     {
         Array array = dv.Value as Array;
         if (array != null)
         {
             ExtensionObject extension1 = array.GetValue(0) as ExtensionObject;
             if (extension1 != null)
             {
                 IEncodeable encodeable = extension1.Body as IEncodeable;
                 if (encodeable != null)
                 {
                     string name = encodeable.GetType().Name;
                     lvi.SubItems[(int)SubItemIndexes.Type].Text = String.Format("{0}[{1}]", name, array.Length);
                 }
             }
             else
             {
                 lvi.SubItems[(int)SubItemIndexes.Type].Text = String.Format("{0}[{1}]", dv.Value.GetType().GetElementType().ToString(), array.Length);
             }
         }
         else
         {
             ExpandedNodeId  datatypeId = null;
             ExtensionObject extension  = dv.Value as ExtensionObject;
             if (extension != null)
             {
                 IEncodeable encodeable = extension.Body as IEncodeable;
                 if (encodeable != null)
                 {
                     datatypeId = encodeable.TypeId;
                 }
                 else
                 {
                     datatypeId = DataTypes.GetDataTypeId(dv.Value);
                 }
             }
             else
             {
                 datatypeId = DataTypes.GetDataTypeId(dv.Value);
             }
             Node datatype = session.NodeCache.Find(datatypeId) as Node;
             if (datatype != null)
             {
                 lvi.SubItems[(int)SubItemIndexes.Type].Text = datatype.ToString();
             }
         }
     }
 }