多年前,我听说有人要证明每个计算机程序只需要三个指令即可解决:
我想听听你的意见.我的意思是将任何算法表示为计算机程序.你同意吗?
我有一些模板文件,我想在我的rails应用程序中使用.我想知道给出两个场景的位置(在哪个目录下):
我只想要通过不仅指定值,而且指定它们将附加到的索引来初始化string []数组常量.
例如,在:
private static readonly string [] Pets = new string [] {"Bulldog","GreyHound"};
我想说BullDog对应于索引29和GreyHound对应5(喜欢php :))
有什么建议吗?
干杯,
我想知道是否有一个标准来设置C#中的函数修饰符的顺序.即
public static void Method()
{}
static public void Method()
{}
Run Code Online (Sandbox Code Playgroud)
这两个都很好,但是
当我编码:
public void static Method()
{}
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
成员修饰符'static'必须位于成员类型和名称之前
和
方法必须具有返回类型
我只是想编写以下扩展方法:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace _4Testing
{
static class ExtensionMethods
{
public static void AssignMe(this int me, int value)
{
me = value;
}
}
}
Run Code Online (Sandbox Code Playgroud)
但它不起作用,我的意思是,我可以使用扩展方法来改变扩展类的值吗?我不想将void返回类型更改为int,只是更改扩展类值.提前致谢
我有这条线:
Directory.Delete(outputfiles, true);
Run Code Online (Sandbox Code Playgroud)
如果我将其设置为true那么它也应该删除子目录和文件.现在我检查了该目录是否为空,因此下次将删除该目录.但在此目录中的异常之前,我有另外4个子目录,其中一个我有一个大约7 Mb大小的zip文件.
System.IO.IOException was unhandled
HResult=-2147024751
Message=The directory is not empty.
Source=mscorlib
StackTrace:
at System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive, Boolean throwOnTopLevelDirectoryNotFound)
at System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive, Boolean checkHost)
at Diagnostic_Tool_Blue_Screen.CreateDirectories.CreateDirectoriesAtConstructor() in d:\C-Sharp\Diagnostic Tool Blue Screen\Diagnostic Tool Blue Screen\Diagnostic Tool Blue Screen\CreateDirectories.cs:line 35
at Diagnostic_Tool_Blue_Screen.Form1..ctor() in d:\C-Sharp\Diagnostic Tool Blue Screen\Diagnostic Tool Blue Screen\Diagnostic Tool Blue Screen\Form1.cs:line 125
at Diagnostic_Tool_Blue_Screen.Program.Main() in d:\C-Sharp\Diagnostic Tool Blue Screen\Diagnostic Tool Blue Screen\Diagnostic Tool Blue Screen\Program.cs:line 19
at System.AppDomain._nExecuteAssembly(RuntimeAssembly …Run Code Online (Sandbox Code Playgroud)