📄 javascriptobject.cs
字号:
/*
* MS 06-04-03 return the correct .Value
*
*
*/
using System;
using System.Collections;
using System.Collections.Specialized;
namespace AjaxPro
{
/// <summary>
/// Represents a JavaScript ECMA object.
/// </summary>
public class JavaScriptObject : IJavaScriptObject
{
private HybridDictionary list = new HybridDictionary();
private StringCollection keys = new StringCollection();
/// <summary>
/// Initializes a new JavaScript object instance.
/// </summary>
public JavaScriptObject() : base()
{
}
/// <summary>
/// Returns the string representation of the object.
/// </summary>
public string Value
{
get
{
return JavaScriptSerializer.Serialize(list);
}
}
#region IDictionary Members
/// <summary>
/// Returns the object defined for the name of the property.
/// </summary>
public object this[string key]
{
get
{
return list[key];
}
}
/// <summary>
/// Verify if the property does exist in the object.
/// </summary>
/// <param name="key">The name of the property.</param>
/// <returns>Returns true if the property is defined.</returns>
public bool Contains(string key)
{
return list.Contains(key);
}
/// <summary>
/// Adds a new property to the object.
/// </summary>
/// <param name="key">The name of the property.</param>
/// <param name="value">The value of the property.</param>
public void Add(string key, object value)
{
list.Add(key, value);
keys.Add(key);
}
/// <summary>
/// Returns all keys that are used internal for the name of properties.
/// </summary>
public string[] Keys
{
get
{
string[] _keys = new string[keys.Count];
keys.CopyTo(_keys, 0);
return _keys;
}
}
public bool IsFixedSize
{
get
{
return false;
}
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -