我正在使用 Ninject Interception 扩展来实现 SQLLogging。我有一个名为“param”的变量,它是一个匿名类型,正如它在 Watch 窗口中显示的那样(见下图)。当我这样做时param.ToString()
,它返回了
{Countries = {System.Collections.Generic.List< int >}
var param = invocation.Request.Arguments[0];
其中 invoation 是 Ninject.Extensions.Interception.IInvoation 接口类型。
我需要得到的是一个名字和它的项目。所以,对于这个,我想要“Countries = 36, 124, 826, 840”之类的东西。
我如何遍历列表来实现这一点?另外,请注意Countries
在这种情况下的名称直到运行时才知道。可能是这样的
{Ages = {System.Collections.Generic.List< int >}
或者
{Subjects={System.Collections.Generic.List< string >}