ToString() public method

public ToString ( ) : String
return String
Ejemplo n.º 1
0
        static void PatternMatchingSwitch(System.ValueType val)
        {
            switch (val)
            {
            case int number:
                Console.WriteLine(number);
                break;

            case long number:
                Console.WriteLine(number);
                break;

            case decimal number:
                Console.WriteLine(number);
                break;

            case float number:
                Console.WriteLine(number);
                break;

            case double number:
                Console.WriteLine(number);
                break;

            case null:
                Console.WriteLine("val is a nullable type with the null value");
                break;

            default:
                Console.WriteLine("Could not convert " + val.ToString());
                break;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取 SQL 语句常量表示串
        /// </summary>
        /// <param name="sdt">已支持类型受限于下级方法实现</param>
        /// <param name="val"></param>
        /// <returns></returns>
        public static string ConvertToSqlON(System.Data.SqlDbType sdt, System.ValueType val)
        {
            #region bool || byte
            if (val is bool || val is byte)
            {
                int    n   = System.Convert.ToInt32(val);
                string rtn = ConvertToSqlON(sdt, n);
                return(rtn.ToString());
            }
            #endregion

            #region 默认处理方式
            if (sdt == System.Data.SqlDbType.BigInt ||
                sdt == System.Data.SqlDbType.Bit ||
                sdt == System.Data.SqlDbType.Decimal ||
                sdt == System.Data.SqlDbType.Float ||
                sdt == System.Data.SqlDbType.Int ||
                sdt == System.Data.SqlDbType.Money ||
                sdt == System.Data.SqlDbType.Real ||
                sdt == System.Data.SqlDbType.SmallInt ||
                sdt == System.Data.SqlDbType.TinyInt
                )
            {
                string rtn = val.ToString();
                return(rtn);
            }

            if (sdt == System.Data.SqlDbType.Char ||
                sdt == System.Data.SqlDbType.DateTime ||
                sdt == System.Data.SqlDbType.NChar ||
                sdt == System.Data.SqlDbType.NText ||
                sdt == System.Data.SqlDbType.NVarChar ||
                sdt == System.Data.SqlDbType.SmallDateTime ||
                sdt == System.Data.SqlDbType.Text ||
                sdt == System.Data.SqlDbType.UniqueIdentifier ||
                sdt == System.Data.SqlDbType.VarChar
                )
            {
                string str = val.ToString();
                string rtn = ConvertToSqlON(sdt, str);
                return(rtn);
            }
            #endregion

            return(NonSupportedOutType);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 获取 SQL 语句常量表示串
        /// </summary>
        /// <param name="sdt">已支持类型受限于下级方法实现</param>
        /// <param name="val"></param>
        /// <returns></returns>
        public static string ConvertToSqlON(MySqlDbType sdt, System.ValueType val)
        {
            #region bool || byte
            if (val is bool || val is byte)
            {
                int    n   = System.Convert.ToInt32(val);
                string rtn = ConvertToSqlON(sdt, n);
                return(rtn.ToString());
            }
            #endregion

            #region 默认处理方式
            if (sdt == MySqlDbType.Int64 ||
                sdt == MySqlDbType.Bit ||
                sdt == MySqlDbType.Decimal ||
                sdt == MySqlDbType.Float ||
                sdt == MySqlDbType.Int32 ||
                sdt == MySqlDbType.Int16 ||
                sdt == MySqlDbType.Int24
                )
            {
                string rtn = val.ToString();
                return(rtn);
            }

            if (sdt == MySqlDbType.DateTime ||
                sdt == MySqlDbType.Date ||
                sdt == MySqlDbType.Time ||
                sdt == MySqlDbType.Text ||
                sdt == MySqlDbType.VarChar
                )
            {
                string str = val.ToString();
                string rtn = ConvertToSqlON(sdt, str);
                return(rtn);
            }
            #endregion

            return(NonSupportedOutType);
        }
Ejemplo n.º 4
0
        void UseAsWithNullable(System.ValueType val)
        {
            int?j = val as int?;

            if (j != null)
            {
                Console.WriteLine(j);
            }
            else
            {
                Console.WriteLine("Could not convert " + val.ToString());
            }
        }
Ejemplo n.º 5
0
        public IBeheerContextEntity GetBusinessObject(string tableName, string kolomName, ValueType value)
        {
            string qry = @"select id, {0} from {1} where {0} = {2}";
            qry = string.Format(CultureInfo.InvariantCulture, qry, kolomName, tableName, value);

            return GetBusinessObject(qry,
                new BeheerContextEntity
                {
                    DataKeyValue = value.ToString(),
                    DataKeyName = kolomName,
                    Tablename = tableName
                });
        }
Ejemplo n.º 6
0
        static StackObject *ToString_2(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.ValueType instance_of_this_method = (System.ValueType) typeof(System.ValueType).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.ToString();

            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
		///<summary>
		/// Find the full document name assuming that we are using the standard conventions
		/// for generating a document key
		///</summary>
		///<returns></returns>
		public string DefaultFindFullDocumentKeyFromValueTypeIdentifier(ValueType id, Type type)
		{
			string idPart;
			var converter = IdentityTypeConvertors.FirstOrDefault(x => x.CanConvertFrom(id.GetType()));
			if (converter != null)
			{
				idPart = converter.ConvertFrom(id);
			}
			else
			{
				idPart = id.ToString();
			}
			return GetTypeTagName(type) + IdentityPartsSeparator + idPart;
		}
Ejemplo n.º 8
0
 static void PatternMatchingNullable(System.ValueType val)
 {
     if (val is int j) // Nullable types are not allowed in patterns
     {
         Console.WriteLine(j);
     }
     else if (val is null) // If val is a nullable type with no value, this expression is true
     {
         Console.WriteLine("val is a nullable type with the null value");
     }
     else
     {
         Console.WriteLine("Could not convert " + val.ToString());
     }
 }
Ejemplo n.º 9
0
 /// <summary>
 /// 类型:方法
 /// 名称:UpdateSpecialAttribute
 /// 作者:taixihuase
 /// 作用:变更饰品特殊属性数值
 /// 编写日期:2015/8/16
 /// </summary>
 /// <param name="value"></param>
 public void UpdateSpecialAttribute(ValueType value)
 {
     if (value != null)
     {
         float f = Convert.ToSingle(value.ToString());
         if (f > 0)
         {
             SpecialAttribute = new KeyValuePair<JewelAttributeType, float>(JewelAttribute, f);
         }
     }
 }
Ejemplo n.º 10
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="paramName"></param>
 /// <param name="value"></param>
 private static void SetParameter(String paramName, ValueType value)
 {
     if (_RemoteConfigurationEnable)
     {
         _RemoteConfig.AppSettings.Settings[paramName].Value = value.ToString();
         _RemoteConfig.Save();
         ConfigurationManager.RefreshSection("appSettings");
     }
     else
     {
         _LocalConfig.AppSettings.Settings[paramName].Value = value.ToString();
         _LocalConfig.Save(ConfigurationSaveMode.Modified, false);
         ConfigurationManager.RefreshSection("appSettings");
     }
     return;
 }
Ejemplo n.º 11
0
 public void InsertValue2At(ValueType newValue, int index)
 {
     if( newValue.IsNull() == false )
         InsertDomChildAt(NodeType.Element, "", "Value", index, newValue.ToString());
 }
Ejemplo n.º 12
0
 protected override void UpdateForgingAttribute(int level, AttributeCode attribute, ValueType value)
 {
     if (ForgingAttributes.ContainsKey(level) && !attribute.Equals(AttributeCode.Null) &&
                     value != null)
     {
         float f = Convert.ToSingle(value.ToString());
         if (f > 0)
         {
             ForgingAttributes[level] = new KeyValuePair<AttributeCode, float>(attribute, f);
         }
     }
 }
Ejemplo n.º 13
0
 string RateHeaderCalc(ValueType e)
 {
     string s = e.ToString();
     switch ((RateIntervalCalc)e)
     {
         case RateIntervalCalc.OverallTime:
             s += " sec";
             break;
     }
     return s;
 }
Ejemplo n.º 14
0
 string DetectorCalibrationHeader(ValueType e)
 {
     string s = e.ToString();
     switch ((DetectorCalibration)e)
     {
         case DetectorCalibration.LongDelay:
         case DetectorCalibration.Predelay:
         case DetectorCalibration.GateLength:
         case DetectorCalibration.DieAwayTime:
         case DetectorCalibration.DTCoeffA:
             s += " µSec";
             break;
         case DetectorCalibration.DTCoeffT:
         case DetectorCalibration.DTCoeffC:
             s += " nSec";
             break;
         case DetectorCalibration.DTCoeffB:
             s += " pSec";
             break;
     }
     return s;
 }
Ejemplo n.º 15
0
 string CoincidenceHeader(ValueType e)
 {
     string s = e.ToString();
     switch ((CoincidenceMatrix)e)
     {
         case CoincidenceMatrix.LongDelay:
         case CoincidenceMatrix.PreDelay:
         case CoincidenceMatrix.GateWidth:
             s += " uSec";
             break;
     }
     return s;
 }
Ejemplo n.º 16
0
 private void NotificationCallback(ValueType rawNetInterface, string source, int code, int size, IntPtr buffer)
 {
     if(InvokeRequired)
     {
         Invoke(new Action(( ) => NotificationCallback(rawNetInterface, source, code, size, buffer)));
     }
     else
     {
         try
         {
             var netInterface = (Guid)rawNetInterface;
             var message = new StringBuilder( );
             message.Append("Notification received from ");
             message.Append(source);
             message.Append(" on interface \"");
             var interfaces = cbInterfaces.DataSource as List<WlanInterface>;
             if (interfaces == null)
             {
                 message.Append(rawNetInterface.ToString( ));
             }
             else
             {
                 var iface = interfaces.FirstOrDefault(x => ((Guid)x.InterfaceGuid).Equals(rawNetInterface));
                 if (iface != null)
                 {
                     message.Append(iface.Description);
                 }
                 else
                 {
                     message.Append(rawNetInterface.ToString( ));
                 }
             }
             message.Append("\" with code ");
             message.Append(code);
             message.Append(" and ");
             message.Append(size);
             message.Append(" bytes at ");
             message.AppendFormat("0x{0:x}", buffer.ToInt64( ));
             message.Append(".");
             MessageBox.Show(message.ToString( ), "WLAN Change Notification", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
         catch(Exception ex)
         {
             UiError(ex);
         }
     }
 }
Ejemplo n.º 17
0
 public static void ReportDuplicateValue(ValueType type, string value)
 {
     LogWarning(string.Format(CultureInfo.CurrentCulture, "Ignoring duplicate {0} value - ", type.ToString()));
     Console.WriteLine("{0}", value);
 }
Ejemplo n.º 18
0
		public void ReplaceValueAt(ValueType newValue, int index)
		{
			ReplaceDomChildAt(NodeType.Element, "", "Value", index, newValue.ToString());
		}
Ejemplo n.º 19
0
		public void InsertValueAt(ValueType newValue, int index)
		{
			InsertDomChildAt(NodeType.Element, "", "Value", index, newValue.ToString());
		}
Ejemplo n.º 20
0
		public void AddValue(ValueType newValue)
		{
			AppendDomChild(NodeType.Element, "", "Value", newValue.ToString());
		}
Ejemplo n.º 21
0
 public XmlNode AddValue2(ValueType newValue)
 {
     if( newValue.IsNull() == false )
         return AppendDomChild(NodeType.Element, "", "Value", newValue.ToString());
     return null;
 }
Ejemplo n.º 22
0
 string RateHeader(ValueType e)
 {
     string s = e.ToString();
     switch ((RateInterval)e)
     {
         case RateInterval.GateWidth:
             s += " 1e-7 s";
             break;
         case RateInterval.OverallTime:
             s += " sec";
             break;
     }
     return s;
 }
 private static object ConvertEnum(Type enumType, ValueType value)
 {
     var r = Enum.Parse(enumType, value.ToString());
     return r;
 }
Ejemplo n.º 24
0
 protected override void UpgradeForgingAttribute(AttributeCode attribute, ValueType value)
 {
     if (CurrentLevel < DataConstraint.EquipmentMaxLevel && !attribute.Equals(AttributeCode.Null) && value != null)
     {
         float f = Convert.ToSingle(value.ToString());
         if (f > 0)
         {
             ForgingAttributes[CurrentLevel + 1] = new KeyValuePair<AttributeCode, float>(attribute, f);
         }
     }
 }