logo
  • 教程列表
  • SO官方文檔
  • 雜湊表
    • 按鍵訪問雜湊表值
    • 建立雜湊表
    • 將鍵值對新增到現有雜湊表
    • 迴圈雜湊表
    • 列舉鍵和鍵值對
    • 從現有雜湊表中刪除鍵值對
  1. StackOverflow 文件
  2. PowerShell 教程
  3. 雜湊表
  4. 按鍵訪問雜湊表值

按鍵訪問雜湊表值

Created: November-22, 2018

定義雜湊表並通過金鑰訪問值的示例

$hashTable = @{
    Key1 = 'Value1'
    Key2 = 'Value2'
}
$hashTable.Key1
#output
Value1

訪問具有屬性名稱的無效字元的鍵的示例:

$hashTable = @{
    'Key 1' = 'Value3'
    Key2 = 'Value4'
}
$hashTable.'Key 1'
#Output
Value3
  • 建立雜湊表
  • 雜湊表

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 關於本站
  • 免責聲明