小编Jor*_*nor的帖子

命名管道的示例

我如何编写一个简单的 - 最简单的工作 - 测试应用程序,说明如何使用IPC /命名管道?

例如,如何编写一个控制台应用程序,程序1将"Hello World"写入程序2,程序2接收消息并将"Roger That"回复给程序1.

c# ipc named-pipes

124
推荐指数
4
解决办法
11万
查看次数

c#设置TextBox的FontSize

如何在c#中设置TextBox的字体大小.我可以获得当前大小,但不允许设置它.

public static Form client;
((TextBox)client.Controls[0]).Font.size = 16;
Run Code Online (Sandbox Code Playgroud)

c# textbox font-size

20
推荐指数
1
解决办法
7万
查看次数

无法使用实例引用访问; 用类型名称来限定它

使用示例1:在此MSDN教程中创建,启动和交互线程,更具体地说是第3行到第7行Main()

我有以下代码,出现以下错误:

无法使用实例引用访问; 用类型名称来限定它.

Program.cs中

public static ThreadTest threadTest = new ThreadTest();
private static Thread testingThread = new Thread(new ThreadStart(threadTest.testThread()));
static void Main(string[] args)
{

}
Run Code Online (Sandbox Code Playgroud)

ThreadTest.cs

public static void testThread()
{
}
Run Code Online (Sandbox Code Playgroud)

c# multithreading

15
推荐指数
1
解决办法
7万
查看次数

我是否需要Visual Studio 2012 for .NET 4.5或者Visual Studio 2010适用于4.5?

我已经安装了.NET Framework 4.5,但我只能在我的项目中使用.NET Framework 4.0,它不支持BigInteger.我需要Visual Studio 2012 for 4.5还是Visual Studio 2010适合4.5?

.net c#

6
推荐指数
2
解决办法
6849
查看次数

正则表达式[]在运行时抛出异常

以下代码抛出

'ConsoleApplication1.Program'的类型初始化程序引发了异常.

在线上

public static Regexp[] keepers = { ... };
Run Code Online (Sandbox Code Playgroud)

为什么这是错的,我该如何解决?

namespace ConsoleApplication1
{
    class Program
    {
        public static String output = "";
        public static Regex[] keepers = { 
                                            new Regex(@"using(?<everythingElse> [a-zA-Z.]+;)"),
                                            new Regex(@"namespace(?<everythingElse> [a-zA-Z._]+)"),
                                            new Regex(@"class(?<everythingElse> [a-zA-Z._]+)"),
                                            new Regex(@"(public|private)? ?(static)? ?(?<type> String|void|int|Double)(" + Regex.Escape("[") + "?" + Regex.Escape("]") + "?" + "(?<functionName> [a-z_]+)(?<params> [^\r\n]+)")
                                        };
        [STAThread]
        static void Main(string[] args)
        {}}}
Run Code Online (Sandbox Code Playgroud)

c# regex

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

提高线程效率

我有以下代码,它将读取文件的字节,然后构造8个单独的字符串,一旦完成,8个字符串将拼凑在一起但是当读取500mb文件时,这段代码需要超过10个小时,然后我放弃运行它.

反正是在提高这段代码的效率,以便它可以更快地运行?

namespace ConsoleApplication1
{
    public class object1
    {
        public static Byte[] split1 = new Byte[18082460];
        public static Byte[] split2 = new Byte[18082460];
        public static Byte[] split3 = new Byte[18082460];
        public static Byte[] split4 = new Byte[18082460];
        public static Byte[] split5 = new Byte[18082460];
        public static Byte[] split6 = new Byte[18082460];
        public static Byte[] split7 = new Byte[18082460];
        public static Byte[] split8 = new Byte[18082452];

        public static String[] output = new String[8];

        public void run1()
        {
            for (int i = …
Run Code Online (Sandbox Code Playgroud)

c# multithreading

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

标签 统计

c# ×6

multithreading ×2

.net ×1

font-size ×1

ipc ×1

named-pipes ×1

regex ×1

textbox ×1