将字典行逐行发送到函数中

Alo*_*iel 0 c# dictionary

我有一本字典,从class Aclass B.

Dictionary<A, B> accounts = new...
Run Code Online (Sandbox Code Playgroud)

我初始化它并插入键和值.

我的字典中有12行.我想逐行发送到一个函数:

foreach (var user in accounts) {
    myfunc(user);
}
Run Code Online (Sandbox Code Playgroud)

但应该myfunc得到什么?

void myfunc(...) {}
Run Code Online (Sandbox Code Playgroud)

任何帮助赞赏!

Mar*_*ell 5

void myfunc(KeyValuePair<A, B> userPair) {}
Run Code Online (Sandbox Code Playgroud)

或者只是在visual studio(ctrl+ .,enter)中"生成方法存根" ,它会为你做到:

private static void myfunc(KeyValuePair<A, B> user)
{
    throw new NotImplementedException();
}
Run Code Online (Sandbox Code Playgroud)