private void ControlsToData()
        {
            if (_item == null)
                _item = new SwitchPort();

            base.ControlsToData();

            SwitchPort switchPort = RepeatedItem as SwitchPort;

            if (dataGridView.Rows.Count == 0)
                switchPort.Pin = null;
            else
            {
                switchPort.Pin = new List<SwitchPortPin>();
                foreach (DataGridViewRow row in dataGridView.Rows)
                {
                    int iLine = 0;
                    String line = row.Cells["line"].Value as String;
                    String name = row.Cells["name"].Value as String;
                    if (!String.IsNullOrEmpty(name) && line != null && int.TryParse( line, out iLine ) )
                    {
                        SwitchPortPin pin = new SwitchPortPin();
                        pin.line = iLine;
                        pin.name = name;
                        switchPort.Pin.Add(pin);
                    }
                }
            }
        }
 public static bool LoadFromFile(string fileName, out SwitchPortPin obj)
 {
     Exception exception;
     return LoadFromFile(fileName, out obj, out exception);
 }
 public static bool Deserialize(string input, out SwitchPortPin obj)
 {
     Exception exception;
     return Deserialize(input, out obj, out exception);
 }
 /// <summary>
 /// Deserializes xml markup from file into an SwitchPortPin object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output SwitchPortPin object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
 public static bool LoadFromFile(string fileName, out SwitchPortPin obj, out Exception exception)
 {
     exception = null;
     obj = default(SwitchPortPin);
     try
     {
         obj = LoadFromFile(fileName);
         return true;
     }
     catch (Exception ex)
     {
         exception = ex;
         return false;
     }
 }
 /// <summary>
 /// Deserializes workflow markup into an SwitchPortPin object
 /// </summary>
 /// <param name="input">string workflow markup to deserialize</param>
 /// <param name="obj">Output SwitchPortPin object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
 public static bool Deserialize(string input, out SwitchPortPin obj, out Exception exception)
 {
     exception = null;
     obj = default(SwitchPortPin);
     try
     {
         obj = Deserialize(input);
         return true;
     }
     catch (Exception ex)
     {
         exception = ex;
         return false;
     }
 }