Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/265.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 泛型类型层次结构的DebuggerTypeProxy_C#_Debugging_Math.net_Mathnet Numerics - Fatal编程技术网

C# 泛型类型层次结构的DebuggerTypeProxy

C# 泛型类型层次结构的DebuggerTypeProxy,c#,debugging,math.net,mathnet-numerics,C#,Debugging,Math.net,Mathnet Numerics,我正在尝试为Math.NET Numerics中的矩阵和向量编写一个调试器类型的代理/代理,以便调试器显示更多有用的信息(同样在F#FSI中)。类型层次结构如下所示: Generic.Matrix Double.Matrix:Generic.Matrix Double.DenseMatrix:Double.Matrix 什么有效 具有闭合的泛型类型的非泛型代理。如果构造函数不接受Matrix而接受Double.Matrix或Double.DenseMatrix,则其工作方式也相同 publi

我正在尝试为Math.NET Numerics中的矩阵和向量编写一个调试器类型的代理/代理,以便调试器显示更多有用的信息(同样在F#FSI中)。类型层次结构如下所示:

  • Generic.Matrix
  • Double.Matrix:Generic.Matrix
  • Double.DenseMatrix:Double.Matrix
什么有效 具有闭合的泛型类型的非泛型代理。如果构造函数不接受
Matrix
而接受
Double.Matrix
Double.DenseMatrix
,则其工作方式也相同

public class MatrixSummary
{
    public MatrixSummary(Matrix<double> matrix) { }
    // ...
}
我想干什么 我不希望为每种类型都实现单独的代理,所以让我们将其设置为通用的:

public class MatrixSummary<T> where T : ...
{
    public MatrixSummary(Matrix<T> matrix) { }
    // ...
}
公共类矩阵摘要,其中T:。。。
{
公共矩阵摘要(矩阵){}
// ...
}
然后,用以下内容装饰Double.DenseMatrix:

[DebuggerTypeProxy(typeof(MatrixSummary))]
[DebuggerTypeProxy(typeof(MatrixSummary<>))]
[DebuggerTypeProxy(typeof(MatrixSummary))]
或者可能以以下方式结束:

[DebuggerTypeProxy(typeof(MatrixSummary<double>))]
[DebuggerTypeProxy(typeof(MatrixSummary))]
和/或如果需要,也可以将该属性添加到基类中

这些都不起作用,例如在调试单元测试时,即使文档中说在使用开放泛型类型(即
MatrixSummary
)声明属性时应该起作用。毕竟,它在
列表
等中也可以正常工作

有什么想法吗

相关的:


矩阵摘要
设为嵌套类:

[DebuggerTypeProxy(typeof(Matrix<>.MatrixSummary))]
[DebuggerTypeProxy(typeof(Matrix.MatrixSummary))]

好主意,谢谢!不幸的是,这对我也不起作用。当前的解决方法:一个由Matrix实现的非通用接口和一个匹配的proxy.Hmmm。。。它确实对我有用。我把它放在基类(即你的
Generic.Matrix
)上,它也会向下延伸到继承的类。奇怪的是,我仍然无法让它工作。我的代理本质上是(矩阵的子对象):公共类MatrixSummary{public MatrixSummary(矩阵m){P=xy;}公共字符串P{get;set;}},并且我已经将上述属性添加到矩阵中。你还做了什么?我在想,像R#这样的设置或工具是否会产生干扰。我使用的是VS2012更新2,版本为R#7.1.2。