System.Convert.ToInt32 C# (CSharp) Method

ToInt32() public static method

public static ToInt32 ( DateTime value ) : int
value DateTime
return int
        public static int ToInt32(DateTime value)
        {
            return ((IConvertible)value).ToInt32(null);
        }

Same methods

Convert::ToInt32 ( String value ) : int
Convert::ToInt32 ( String value, IFormatProvider provider ) : int
Convert::ToInt32 ( String value, int fromBase ) : int
Convert::ToInt32 ( bool value ) : int
Convert::ToInt32 ( byte value ) : int
Convert::ToInt32 ( char value ) : int
Convert::ToInt32 ( decimal value ) : int
Convert::ToInt32 ( double value ) : int
Convert::ToInt32 ( float value ) : int
Convert::ToInt32 ( int value ) : int
Convert::ToInt32 ( long value ) : int
Convert::ToInt32 ( object value ) : int
Convert::ToInt32 ( object value, IFormatProvider provider ) : int
Convert::ToInt32 ( sbyte value ) : int
Convert::ToInt32 ( short value ) : int
Convert::ToInt32 ( uint value ) : int
Convert::ToInt32 ( ulong value ) : int
Convert::ToInt32 ( ushort value ) : int

Usage Example

Beispiel #1
0
        // TwoWayRequest: Accept two integer values, return their sum
        public byte[] TwoWayRequest(WsWsaHeader header, XmlReader reader)
        {
            try
            {
                // Find beginning of request
                reader.ReadStartElement("TwoWayRequest", SimpleServiceNamespaceUri);

                // Find the values to be added
                int X = Convert.ToInt32(reader.ReadElementString("X", SimpleServiceNamespaceUri));
                int Y = Convert.ToInt32(reader.ReadElementString("Y", SimpleServiceNamespaceUri));

                Log.Comment("");
                Log.Comment("X = " + X.ToString() + " Y = " + Y.ToString());
                Log.Comment(X.ToString() + " + " + Y.ToString() + " = " + ((int)(X + Y)).ToString());
                Log.Comment("");

                // Return the response
                return(TwoWayResponse(header, X + Y));
            }
            catch (Exception e)
            {
                // Something went wrong
                throw new WsFaultException(header, WsFaultType.XmlException, e.ToString());
            }
        }
All Usage Examples Of System.Convert::ToInt32