当我运行我的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) 在32位系统上应用(理论上)有多少内存?不同的操作系统?2或1 Gb?
谢谢!
我们定义接口如下:
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)
有什么想法吗?
这可能是一个愚蠢的问题,但......
重构我的代码,我想出了一个我找不到任何答案的问题:
假设我有一个对象MyDumyObject包含字符串的属性Foo和Bar
假设我也有一个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) c# ×3
.net ×2
class ×1
debugging ×1
inheritance ×1
interface ×1
optimization ×1
refactoring ×1
x86 ×1