Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/16.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# DebuggerDisplay中的跨语言数据行索引_C#_Vb.net_Visual Studio_Visual Studio 2017_Debuggerdisplay - Fatal编程技术网

C# DebuggerDisplay中的跨语言数据行索引

C# DebuggerDisplay中的跨语言数据行索引,c#,vb.net,visual-studio,visual-studio-2017,debuggerdisplay,C#,Vb.net,Visual Studio,Visual Studio 2017,Debuggerdisplay,我正在尝试自定义调试对象工具提示。为了实现这一点,我在Visualizers文件夹()中有一个库,其中包括Assembly:DebuggerDisplayattributes() 我希望看到vb.net中的DataRow索引 或者用c# 问题在于,表达式是在调试时计算的,并且对象自引用(Mexthis)在两种语言中是不同的。所以我得到了 CS0103当前上下文中不存在名称“Me” 在调试c#代码时的工具提示中 有没有一种方法可以使用两种语言通用的语法获取DataRow的索引?的源代码 显示

我正在尝试自定义调试对象工具提示。为了实现这一点,我在Visualizers文件夹()中有一个库,其中包括
Assembly:DebuggerDisplay
attributes()

我希望看到vb.net中的DataRow索引


或者用c#

问题在于,表达式是在调试时计算的,并且对象自引用(
Me
x
this
)在两种语言中是不同的。所以我得到了

CS0103当前上下文中不存在名称“Me”
在调试c#代码时的工具提示中

有没有一种方法可以使用两种语言通用的语法获取DataRow的索引?

的源代码

显示它返回

如果我们假设直接调用
GetIndexByNode
并直接传递
DataRow.RBTreeNodeId
值是有效的,那么下面的方法应该可以工作

[assembly: DebuggerDisplay(@"Index = {Table.Rows.list.GetIndexByNode(RBTreeNodeId)}", Target = typeof(System.Data.DataRow))]
    public Int32 IndexOf(DataRow row) {
        if ((null == row) || (row.Table != this.table) || ((0 == row.RBTreeNodeId) && (row.RowState == DataRowState.Detached))) //Webdata 102857
            return -1;
        return list.IndexOf(row.RBTreeNodeId, row);
    }
    public int IndexOf (int nodeId, K item)
    {
        int index = -1;
        // BIG ASSUMPTION: There is not satellite tree, this is INDEX_ONLY.
        if (nodeId != NIL)
        {
            if ( (Object) Key(nodeId) == (Object)item) {
                return GetIndexByNode(nodeId);
            }
            if ( (index=IndexOf(Left(nodeId), item)) != -1) {
                return index;
            }
            if ( (index=IndexOf(Right(nodeId), item)) != -1) {
                return index;
            }
        }

        return index;
    }
[assembly: DebuggerDisplay(@"Index = {Table.Rows.list.GetIndexByNode(RBTreeNodeId)}", Target = typeof(System.Data.DataRow))]