// NAnt - A .NET build tool // Copyright (C) 2001-2003 Gerry Shaw // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // Gert Driesen (gert.driesen@ardatis.com) using System; using System.Globalization; using NAnt.Core.Attributes; namespace NAnt.Core.Functions { [FunctionSet("double", "Conversion")] public class DoubleConversionFunctions : FunctionSetBase { #region Public Instance Constructors public DoubleConversionFunctions(Project project, PropertyDictionary properties) : base(project, properties) { } #endregion Public Instance Constructors #region Public Static Methods /// /// Converts the specified string representation of a number to its /// double-precision floating point number equivalent. /// /// A string containing a number to convert. /// /// A double-precision floating point number equivalent to the numeric /// value or symbol specified in . /// /// is not a number in a valid format. /// represents a number less than or greater than . /// /// The for the invariant culture is /// used to supply formatting information about . /// [Function("parse")] public static double Parse(string s) { return double.Parse(s, CultureInfo.InvariantCulture); } /// /// Converts the specified to its equivalent /// string representation. /// /// A to convert. /// /// The string representation of formatted /// using the general format specifier ("G"). /// /// /// is formatted with the /// for the invariant culture. /// [Function("to-string")] public static string ToString(double value) { return value.ToString(CultureInfo.InvariantCulture); } #endregion Public Static Methods } }