基于丰富的stackoverflow,我一直在研究是否对特定的c#代码进行了尾递归优化.一些问题似乎在讨论
从C#4.0(Visual Studio 2013/2015)开始,如果可以确保尾递归优化,如何确保尾递归优化呢?
是否有某种布尔值我可以用来检查表单的实例是否被加载,或者等到表单加载?
例如:
While(form_loaded == false) {
Try {
//do something
}
catch {
}//do try catch so code won't barf
}
Run Code Online (Sandbox Code Playgroud)
我一直得到以下异常:
System.Windows.Forms.dll中出现类型为"System.InvalidOperationException"的第一次机会异常
System.Windows.Forms.dll中发生了未处理的"System.InvalidOperationException"类型异常
附加信息:
Invoke或者BeginInvoke在创建窗口句柄之前无法在控件上调用.
这就是我所担心的.
另外,如果需要更详细的解释,我可以尝试发布一些代码和/或更多输出调试信息.
我正在用robotc编程,这只是带有附加程序的c编程(遵循所有c规则)。为了组织我的代码,我已将子例程放在头文件中并从我的主c文档进行引用。我是否仍可以引用c文档的头文件中的方法,而无需将函数原型放在头文件中?
例如:
main1.c中的代码
#include header1.h
task main()
{
header_method();
}
Run Code Online (Sandbox Code Playgroud)
header1.h中的代码(无函数原型)
header_method()
{
//do stuffs
}
Run Code Online (Sandbox Code Playgroud)
还是我必须这样做:
void header_method();
header_method()
{
//do stuffs
}
Run Code Online (Sandbox Code Playgroud)
原因是我只能在robotc中为我的机器人声明一定数量的全局变量。
最近我完全被我的代码中的一个奇怪的错误弄糊涂了,并且达到了极度沮丧的程度.最后,我把System.out.println();我的代码放进去,直到我把它缩小,以揭示最离奇的结果.这是代码:
for (Iterator<Integer> it = list.iterator(); it.hasNext();) {
i = it.next();
System.out.println(DeathWish.getInstanceListReference()
.get(DeathWish.getInstanceListReference().size() -1) );
System.out.println("Golden number: " +
(DeathWish.getInstanceListReference().size() -1) );
System.out.println((DeathWish.getInstanceListReference().size() -1) == i);
System.out.println("CurrentInstance List: " +
Arrays.toString(DeathWish.getInstanceListReference().toArray()));
System.out.println("Iteration: " + i);
try {
System.out.println( DeathWish.getInstanceListReference()
.remove((int)list.get(i))); //remove unwanted objects from game paint list
} catch(IndexOutOfBoundsException ex) {
System.err.println(ex + " Error with multiple GameObj objects");
} finally {
System.out.println("\n");
}
}
Run Code Online (Sandbox Code Playgroud)
和输出:
DeathWish.Bullet@ddd5de
Golden number: 2
true
CurrentInstance List: [DeathWish.Player@3a5cf7, DeathWish.Bullet@6cca54, DeathWish.Bullet@ddd5de]
Iteration: 2 …Run Code Online (Sandbox Code Playgroud) java iteration debugging runtime-error indexoutofboundsexception
最近安装了包含 Xamarin.iOS 10.4 的 Visual Studio 2017。我还有一台安装了 x-code 和 Xamarin Studio 社区的 Macintosh。问题是我 mac 上的 Xamarin Studio 版本为 10.3。试图通过切换xamarin到的β信道通过检查更新升级到10.4使Mono Framework MDK 4.8.0.478沿着与失败Xamarin.iOS 10.4.0.97。尝试访问下载页面(您需要登录才能查看该页面)仅允许下载最多Xamarin.iOS 10.3.1.
有没有办法做到以下几点:
Xamarin Studio 日志可以根据要求提供,但我找不到任何关于错误或失败的信息,因为它们只写出关于安装成功的事件而不是下载状态。