小编Ank*_*itG的帖子

在C#中创建三级嵌套字典

我想创建一个以下类型的字典,

var data = new Dictionary<string, Dictionary<string, Dictionary<string, int>>>();
Run Code Online (Sandbox Code Playgroud)

当我尝试以下列方式向字典添加值时,我得到一个KeyNotFound异常.

data[key1][key2][key3]= 3;
Run Code Online (Sandbox Code Playgroud)

我在这做错了什么?我假设如果在字典中找不到密钥,它会自动添加到字典中.

否则有没有办法在运行时添加键?

我期待以下类型的输出:

 [male,[animal,[legs,4]

               [eyes,2]]
       [human,[hands,2]
               [ears,2]]

[female,[animal,[nose,1]

                 [eyes,2]]
         [bird,[wings,2]
                 [legs,2]]
Run Code Online (Sandbox Code Playgroud)

c# dictionary

5
推荐指数
1
解决办法
2587
查看次数

使用函数 gen_random_uuid() 的 PostgreSQL 查询在 Windows 上不起作用

我有以下用于创建表的查询,

CREATE TABLE IF NOT EXISTS company (
    id uuid CONSTRAINT companyid PRIMARY KEY DEFAULT gen_random_uuid(),
    name varchar(128) NOT NULL,
    db_uri varchar(255) NOT NULL,
    c_uri varchar(255) NOT NULL,
    date_c timestamp DEFAULT now(),
    date_m timestamp DEFAULT now()
    ) WITH (fillfactor=90);
Run Code Online (Sandbox Code Playgroud)

当我通过 pgAdminIII 运行它时,出现以下错误。

ERROR:  function gen_random_uuid() does not exist
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
********** Error **********
ERROR: function gen_random_uuid() does not exist
SQL state: 42883
Hint: No …
Run Code Online (Sandbox Code Playgroud)

postgresql pgcrypto

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

c# ×1

dictionary ×1

pgcrypto ×1

postgresql ×1