XML to DataSet的一個類

2010-08-28 10:48:35來源:西部e網(wǎng)作者:

AOl寫了一個DataSet,是將XML轉為Objcet后再轉DataSet,我發(fā)現(xiàn)轉Objcet這個步驟Flash花了很長的時間。AOL在注釋中也寫到考慮直接從XML to DataSet,所以就修改了這個DataSet。將DataSet性能提高了4倍。

    public function set Data (value : Object) : Void
    {
        _data = value;
        _tables = new Object ();
        DataSetName = _data.nodeName;
        var _oldTableName = "";
        var nodes = _data.childNodes;
        for (var i = 0; i < nodes.length - 1; i ++)
        {
            var _TableName = nodes [i].nodeName;
            if (_oldTableName != _TableName)
            {
                var _DataTable = new DataTable ();
            }
            _DataTable.Add (nodes [i]);
            this.Tables [_TableName] = _DataTable;
            _oldTableName = _TableName;
        }
    }

 

關鍵詞:c#

贊助商鏈接: