我是序列化的新手,甚至是protobuf的新手.这是我的问题,我有这些课程:
[ProtoContract]
class Controle
{
[ProtoMember(1, AsReference=true)]
public HashSet<Controle> ControlesInternes { get; set; }
[ProtoMember(2)]
public string TypeControle { get; set; }
[ProtoMember(3)]
public Dictionary<string, string> Attributs { get; set; }
[ProtoMember(4)]
public int Ligne { get; set; }
[ProtoMember(5)]
public string InnerText { get; set; }
[ProtoMember(6)]
public Controle Parent { get; set; }
public Controle()
{
ControlesInternes = new HashSet<Controle>();
Attributs = new Dictionary<string, string>();
}
}
Run Code Online (Sandbox Code Playgroud)
[ProtoContract(SkipConstructor=true)]
class PageAspx
{
[ProtoMember(1)]
public string PrefixeControleOnilait { get; set; …Run Code Online (Sandbox Code Playgroud) 我有2个申请,A和B.
感谢这篇MSDN文章,我设法以某种方式重定向B的输出并提供其输入.
我无法做的是在B中使用Console.ReadKey函数.我试了一下这个函数的catch块,我得到了这个错误信息:
当任一应用程序没有控制台或从文件重定向控制台输入时,无法读取密钥.试试Console.Read
事实是,我必须使用Console.ReadKey,所以我需要找到一种方法让它工作......任何想法?
以下是A代码的有用部分
在主要功能:
Process P2 = new Process();
P2.StartInfo.FileName = Environment.CurrentDirectory + "\\Main2.exe";
P2.StartInfo.UseShellExecute = false;
P2.StartInfo.RedirectStandardOutput = true;
P2.OutputDataReceived += new DataReceivedEventHandler(WriteOutput);
P2.StartInfo.RedirectStandardInput = true;
P2.Start();
StreamWriter ExeInput = P2.StandardInput;
P2.BeginOutputReadLine();
ConsoleKeyInfo KeyPressed;
do
{
KeyPressed = Console.ReadKey();
if(KeyPressed.Key == ConsoleKey.Enter)
{
Console.WriteLine ();
ExeInput.Write("\n");
}
else
ExeInput.Write(KeyPressed.KeyChar);
} while (!P2.HasExited);
Run Code Online (Sandbox Code Playgroud)
outputdatareceived的处理程序:
private static void WriteOutput(object sendingProcess, DataReceivedEventArgs outLine)
{
if (!String.IsNullOrEmpty(outLine.Data))
{
Console.WriteLine(outLine.Data);
}
}
Run Code Online (Sandbox Code Playgroud) 假设我有这段代码:
int i = 31240;
string Number = ((double)i / 1000).ToString("0.#k");
Run Code Online (Sandbox Code Playgroud)
我得到这个结果作为数字的字符串:31,2k
而现在,我想做的恰恰相反,就是把这个字符串"31,2k"带回31240甚至31200,但我不知道该怎么做......有什么想法吗?
有人说这是不可能的.但最后我找到了实现目标的完美方式.我为那些愿意知道的人发布解决方案.使用很简单,它允许进行两种转换:
我正在尝试用LINQPad学习LINQ,但事实是我有一个笔记本.
因此,我不想在其上安装SQL Server(我甚至不相信我能做到这一点).
一些LINQPAD示例使用名为nutshell.mdf的数据库,我想知道我是否可以找到此数据库的SQLite版本,以及在哪里?