下面的代码是在C#中,我使用的是Visual Studio 2010.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
namespace FrontEnd
{
class Flow
{
long i;
private int x,y;
public int X
{
get;set;
}
public int Y
{
get;set;
}
private void Flow()
{
X = x;
Y = y;
}
public void NaturalNumbers(int x, int y)
{
for (i = 0; i < 9999; i++)
{
Console.WriteLine(i);
}
MessageBox.Show("done");
}
}
}
Run Code Online (Sandbox Code Playgroud)
当我编译上面的代码时,我收到此错误:
错误:'Flow':成员名称不能与其封闭类型相同
为什么?我该如何解决这个问题?
我是linux平台的新手,我想为ubuntu提取gnutls.如果我做,
$ls
Run Code Online (Sandbox Code Playgroud)
然后,它将在下面显示这些文件.
gnutls-3.2.1.tar.lz
gnutls-3.2.1.tar.lz.sig
gnutls-3.2.1.tar.xz
gnutls-3.2.1.tar.xz.sig
Run Code Online (Sandbox Code Playgroud)
当我发出命令时,
$ tar -xvf gnutls-3.2.1.tar.xz
Run Code Online (Sandbox Code Playgroud)
我得到输出,
tar: xz: Cannot exec: No such file or directory
tar: Error is not recoverable: exiting now
tar: Child returned status 2
tar: Exiting with failure status due to previous errors
Run Code Online (Sandbox Code Playgroud)
我想提取这些文件.
gpgv <filename>.sig命令验证,它说没有找到公钥.我想打印4个字节的无符号整数的最大值.
#include "stdafx.h"
#include "conio.h"
int _tmain(int argc, _TCHAR* argv[])
{
unsigned int x = 0xffffffff;
printf("%d\n",x);
x=~x;
printf("%d",x);
getch();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
但我输出为-1和0.如何打印x = 4294967295?
我正在学习依赖属性.我读过很多帖子和书籍,但我还不清楚.
下面显示的程序是我写的要学习的.有些错误,请帮忙解决.我有疑问
这是我的代码:
namespace DependencyProperties
{
public class Contact
{
private int id=100;
private string name="shri";
public static readonly DependencyProperty IsPresentProperty;
public int ID
{
get { return id; }
}
public string NAME
{
get { return name; }
}
static Contact()
{
IsPresentProperty = DependencyProperty.Register("IsPresent", typeof(bool),typeof(Contact),new FrameworkPropertyMetadata(false,new PropertyChangedCallback(OnIsPresentChanged)));
}
public bool Present
{
get { return (bool)GetValue(Contact.IsPresentProperty); }
set { SetValue(Contact.IsPresentProperty, value); }
}
private static void OnIsPresentChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) …Run Code Online (Sandbox Code Playgroud) 我想使用充气城堡TLS库使用套接字在服务器和客户端之间进行通信.我浏览了很多文档(对我来说不够用),但我不知道怎么做,
我正在使用BouncyCastle v1.7.48(运行时版本= v2.0.50727)二进制文件,我找到了这些信息,
我必须使用,Org.BouncyCastle.Crypto.Tls命名空间和TlsProtocolHandler类.
要实现TLS通信,
我应该在客户端使用什么API?
System.IO.Stream inputStream, outputStream;
TlsProtocolHandler tls = new TlsProtocolHandler(inputStream, outputStream);
Run Code Online (Sandbox Code Playgroud)有什么参数inputStream和outputStream?
public virtual void Connect(TlsClient tlsClient);
where,TlsClient是一个接口,里面包含许多接口.
4.如何使用上述API?我必须声明新类并在其中实现所有方法?
请帮助我这个充气城堡.
编辑1:
我创建了一个继承自一个名为的抽象类的类DefaultTlsClient.然后我可以创建我的类的实例并将其传递给接口引用.所以我可以像这样发送参数.tls.Connect(tlsClient);
我没有初始化除上面提到的任何参数.(在2055年这些操作之前连接套接字)但我不确定握手是否完成.我的程序将进入阅读状态.
请考虑以下代码:
// Create a new application domain
AppDomain ad = AppDomain.CreateDomain("New domain");
Worker work = new Worker();
// if Worker class is marked as 'MarshalByRefObject', this will run in current
// appdomain.
// if Worker class is NOT marked as 'MarshalByRefObject' and is marked as
// 'Serializable', this will run in a new appdomain.
ad.DoCallBack(work.PrintDomain);
// or ad.DoCallBack(new CrossAppDomainDelegate(work.PrintDomain));
// But for static methods:
// If ppp method is static, no marking is required and it will run in
// …Run Code Online (Sandbox Code Playgroud) 我在c#中生成随机数问题.如果我直接运行此表单应用程序,则随机数生成对所有人来说都是相同的.
如果我通过按F10逐行调试,那么它将生成不同的随机数.为什么会这样?我该怎么做才能生成不同的随机数?
Greyhound.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ADayAtTheRaces
{
class Greyhound
{
int location=0;
Random randomize = new Random();
public int run()
{
location = randomize.Next(0, 100);
return location;
}
}
}
Run Code Online (Sandbox Code Playgroud)
Form1.cs的
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ADayAtTheRaces
{
public partial class Form1 : Form
{
Greyhound[] greyHound = new Greyhound[4];
ProgressBar[] progressBar = new ProgressBar[4]; …Run Code Online (Sandbox Code Playgroud) using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
namespace LearnThread
{
class Delay
{
public int timePass()
{
static int i=0;
for(i=0; i<100;i++)
{
Thread.Sleep(1000);
}
return i;
}
}
}
Run Code Online (Sandbox Code Playgroud)
错误:修饰符'static'对此项无效
为什么静态是错误的?因为我们可以在C语言中使用,所以我们不能使用static for int?
psApdu->prgbCData = (byte_t*)malloc(APDU_BUFFER_LENGTH);
memset((void*)psApdu->prgbCData, 0, APDU_BUFFER_LENGTH);
byte_t prgData[] = { 0x01, 0x38, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02 };
memcpy((byte*)psApdu->prgbCData, prgData, sizeof(prgData));
free(psApdu->prgbCData);
Run Code Online (Sandbox Code Playgroud)
“免费”声明在这里失败了。是什么原因?
我有下面的代码列出目录和子目录中的所有文件.
def GetListFiles(rootdir,fileextension):
import os
testfiles = []
for root,subfolders,files in os.walk(rootdir):
for file in files:
ext = "." + fileextension
if (os.path.splitext(file)[-1].lower()==ext) and (file!="AssemblyInfo.cs"):
testfiles.append(os.path.join(root,file))
return testfiles
Run Code Online (Sandbox Code Playgroud)
在该行中for root,subfolders,files in os.walk(rootdir):,subfolders不使用变量.如果我删除它,那是错误的
"打开太多值(预期2)"
我怎么能避免这个?
c# ×4
c ×2
.net ×1
.net-4.0 ×1
appdomain ×1
bouncycastle ×1
c#-4.0 ×1
gnutls ×1
python ×1
python-3.3 ×1
ssl ×1
tar ×1
ubuntu-10.04 ×1
wpf ×1