小编And*_*rey的帖子

调试StackOverFlow异常

当我运行我的C#程序时,它会在DLL上的一个方法中抛出一个Stack Overflow异常,我在我的解决方案中引用了它.但我没有可用的调试信息,因为它说它是一个堆栈溢出异常并且没有可用的信息.我应该遵循哪些下一步调试步骤来了解发生了什么以及为什么?

谢谢

编辑:这是停在的代码:

static public Collection SortCollection(Collection oCollection, string sPropertyName, string sKeyPropertyName)
{ 
    return SortCollection(oCollection, sPropertyName, sKeyPropertyName); 
} 
Run Code Online (Sandbox Code Playgroud)

c# debugging

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

32(x86)上应用程序内存空间的最大大小?2 Gb还是1 Gb?

在32位系统上应用(理论上)有多少内存?不同的操作系统?2或1 Gb?

谢谢!

x86 virtual-memory

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

界面奇迹问题

我们定义接口如下:

interface IMyInterface
{
    void MethodToImplement();
}
Run Code Online (Sandbox Code Playgroud)

以及如下的恭维:

class InterfaceImplementer : IMyInterface
{
    static void Main()
    {
        InterfaceImplementer iImp = new InterfaceImplementer();
        iImp.MethodToImplement();
    }

    public void MethodToImplement()
    {
        Console.WriteLine("MethodToImplement() called.");
    }
}
Run Code Online (Sandbox Code Playgroud)

而不是创建一个接口,为什么我们可以直接使用该功能如下:-)

class InterfaceImplementer
{
    static void Main()
    {
        InterfaceImplementer iImp = new InterfaceImplementer();
        iImp.MethodToImplement();
    }

    public void MethodToImplement()
    {
        Console.WriteLine("MethodToImplement() called.");
    }
}
Run Code Online (Sandbox Code Playgroud)

有什么想法吗?

.net c# inheritance interface class

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

两个循环比一个循环更昂贵,重新组合C#中两个代码的代码?

这可能是一个愚蠢的问题,但......

重构我的代码,我想出了一个我找不到任何答案的问题:

假设我有一个对象MyDumyObject包含字符串的属性FooBar

假设我也有一个MyDumyObject叫做的集合MyDumyCollection

foreach(MyDumyObject obj in MyDumyCollection)
{
    obj.Foo = "fooooooooo";
    obj.Bar = "baaaaaaaar";
}
Run Code Online (Sandbox Code Playgroud)

相当于

foreach(MyDumyObject obj in MyDumyCollection)
{
    obj.Foo = "fooooooooo";
}

foreach(MyDumyObject obj in MyDumyCollection)
{
    obj.Bar = "baaaaaaaar";
}
Run Code Online (Sandbox Code Playgroud)

我猜:没有,但我被C#和C#编译器以前的工作方式多次欺骗了,所以我现在对我的假设很谨慎,我很高兴得到确认或反驳.

附属问题:

foreach(MyDumyObject obj in MyDumyCollection)
{
    obj.Foo = "fooooooooo";

    // ....

    obj.Foo = "foooooooooooooooooooooooo";
}
Run Code Online (Sandbox Code Playgroud)

相当于

foreach(MyDumyObject obj in MyDumyCollection)
{
    obj.Foo = "fooooooooo";
}

// ....

foreach(MyDumyObject obj in MyDumyCollection)
{
    obj.Foo …
Run Code Online (Sandbox Code Playgroud)

.net c# optimization refactoring

0
推荐指数
1
解决办法
129
查看次数