string <-> int/float conversion pain in .net winform
        Posted  
        
            by Benny
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Benny
        
        
        
        Published on 2010-02-25T10:51:54Z
        Indexed on 
            2010/04/09
            18:43 UTC
        
        
        Read the original article
        Hit count: 355
        
the Text property of control on winform is always string type, so if i wanna expose property of other type for custom control, i have to do the conversion as following, if i have dozens of properties to expose, it will be such pain for me.
  public int ImageGroupLength
    {
        get
        {
            return int.Parse(this.imageGroupLength.Text);
        }
        set
        {
            this.imageGroupLength.Text = value.ToString();
        }
    }
so, is there any elegant way to do the conversion?
© Stack Overflow or respective owner