📜  ASP 关键属性

📅  最后修改于: 2022-05-13 01:56:44.880000             🧑  作者: Mango

ASP 关键属性

ASP 键属性用于将现有键值对更改为字典对象中的新键值。

句法:

DictionaryObject.Key(key)=newkey 

参数:此方法有两个参数,如上所述,下面讨论:

  • Key:它指定必须更改的现有密钥的名称。
  • newkey:它定义了密钥的新名称。它是必需的属性。

例子:

ASP
<%
Dim dict
  
'Create a new dictionary
Set dict=Server.CreateObject("Scripting.Dictionary")
  
'Add values to the dictionary
dict.Add "m","mouse"
dict.Add "k","keyboard"
dict.Add "h","headphones"
  
'Change the key of one of pairs
dict.Key("h")="hd"
  
'Checking the new key
Response.Write("Value of changed key 'hd' is: " & dict.Item("hd"))
%>


输出:

"Value of changed key 'hd' is: headphones