dictionary class : Copy() method

Description

Gets a copy of the caller dictionary.

Syntax

dictionaryInstance.Copy()

Arguments

None

Return value

ClassDescription
some dictionaryA copied dictionary.

Sample code

dictionary{int} orgDic = new dictionary{int}();

orgDic.Add("item1", 10);

orgDic.Add("item2", 8);

orgDic.Add("item3", 9);

dictionary{int} newDic = orgDic.Copy();

int i1 = newDic.Get("item1"); // 10

int i2 = newDic.Get("item2"); // 8

int i3 = newDic.Get("item3"); // 9

Notes

This method is added in Ver 1.1.0.0.

The returned dictionary is a shallow copy of the caller dictionary. That is, the caller and the returned dictionary refer to the same element.

Links for reference

None

Copyright © Rice All rights reserved.