RFID.RFIDInterface.Source_FrequencyBand_TypeConverter.ConvertTo C# (CSharp) Method

ConvertTo() public method

public ConvertTo ( System context, System culture, object value, Type destinationType ) : object
context System
culture System
value object
destinationType System.Type
return object
        public override object ConvertTo(
            System.ComponentModel.ITypeDescriptorContext context,
            System.Globalization.CultureInfo             culture,
            object                                       value,
            Type                                         destinationType
        )
        {
            if ( typeof( string ) == destinationType )
            {
                Source_FrequencyBand channel = value as Source_FrequencyBand;

                if ( null == channel )
                {
                    throw new ArgumentException( "Expected a Source_FrequencyBand", "value" );
                }

                StringBuilder sb = new StringBuilder( );

                sb.AppendFormat
                    (
                        "{0},{1},{2},{3},{4},{5},{6},{7}",
                        ( UInt32 ) channel.band,
                        channel.state.ToString( ),
                        ( UInt16 ) channel.multiplier,
                        ( UInt16 ) channel.divider,
                        ( UInt16 ) channel.guardBand,
                        ( UInt16 ) channel.maxDACBand,
                        ( UInt16 ) channel.affinityBand,
                        ( UInt16 ) channel.minDACBand
                    );

                return sb.ToString( );
            }

            return base.ConvertTo( context, culture, value, destinationType );
        }
Source_FrequencyBand_TypeConverter