JavaScriptNumber.cs
上传用户:szgaoree
上传日期:2009-01-05
资源大小:74k
文件大小:1k
- using System;
- using System.Collections;
- namespace AjaxPro
- {
- /// <summary>
- /// Represents a JavaScript ECMA number.
- /// </summary>
- public class JavaScriptNumber : IJavaScriptObject
- {
- private string _value = string.Empty;
- /// <summary>
- /// Initializes a new JavaScript number instance.
- /// </summary>
- public JavaScriptNumber() : base()
- {
- }
- /// <summary>
- /// Returns the string representation of the object.
- /// </summary>
- public string Value
- {
- get
- {
- return _value;
- }
- }
- #region Internal Methods
- internal void Append(string s)
- {
- _value += s;
- }
- internal void Append(char c)
- {
- _value += c;
- }
- internal int IndexOf(string s)
- {
- return _value.IndexOf(s);
- }
- #endregion
- #region Public Operators
- public override string ToString()
- {
- return this.Value;
- }
- public static implicit operator string(JavaScriptNumber o)
- {
- return o.Value;
- }
- public static JavaScriptNumber operator +(JavaScriptNumber a, string s)
- {
- a.Append(s);
- return a;
- }
- public static JavaScriptNumber operator +(JavaScriptNumber a, char c)
- {
- a.Append(c);
- return a;
- }
- #endregion
- }
- }