我在.NET中创建了一个应用程序.当我编译64位版本和相同软件的32位版本时,64位可执行文件更小.
但是,当您同时运行它们时,64位版本使用更多RAM.
我确信某些事情正在"幕后"发生,而且只是感兴趣为什么?(不管怎样都不用担心)
谢谢.
编辑:C#.NET 4.0如果重要的话.
我正在使用WinForms C#有什么方法可以获得以下行为:
我试着做以下事情:
构造函数代码:
checkedlistBox1.DataSource = a;
checkedlistBox1.DisplayMember = "Name";
checkedlistBox1.ValueMember = "Name";
Run Code Online (Sandbox Code Playgroud)
领域:
List<Binder> a = new List<Binder> { new Binder { Name = "A" } };
在按钮1上单击:
private void butto1_Click(object sender, EventArgs e)
{
a.Add(new Binder{Name = "B"});
checkedListBox1.Invalidate();
checkedListBox1.Update();
}
Run Code Online (Sandbox Code Playgroud)
但视图不会更新.
谢谢.
我正在尝试通过C#执行OS命令。我从该网页获取以下代码:
//Execute command on file
ProcessStartInfo procStart =
new ProcessStartInfo(@"C:\Users\Me\Desktop\Test\System_Instructions.txt",
"mkdir testDir");
//Redirects output
procStart.RedirectStandardOutput = true;
procStart.UseShellExecute = false;
//No black window
procStart.CreateNoWindow = true;
//Creates a process
System.Diagnostics.Process proc = new System.Diagnostics.Process();
//Set start info
proc.StartInfo = procStart;
//Start
proc.Start();
Run Code Online (Sandbox Code Playgroud)
但是当我尝试运行代码时,出现以下错误:
{"The specified executable is not a valid application for this OS platform."}
我究竟做错了什么?我也尝试过这个例子,但是遇到了同样的问题。
在我的程序中,我有2个ComboBoxes作为DropDown列表.我想在第一个ComboBox中的项目被选中后才向第二个ComboBox添加项目.
到目前为止我有这个:
InitializeComponent();
comboBox1.Items.Add("Category1");
comboBox1.Items.Add("Category2");
comboBox1.Items.Add("Category3");
comboBox1.SelectedValueChanged += new EventHandler(comboBox1_TextChanged);
private void comboBox1_TextChanged(object sender, EventArgs e)
{
if (comboBox1.SelectedText.Equals("Category 1"))
{
DataTable cat = dataTableAdapter.GetByCategory("category1");
foreach (DataRow row in cat.Rows)
{
comboBox2.Items.Add(row.ItemArray[1]);
}
}
}
Run Code Online (Sandbox Code Playgroud) 文本文件格式
headerinfo = "abc" **part1=001** element1 element2.... ... element15 end_element **part2=002** element1 element2.... ... emelent15 end_element ...... end_header
我想从part1=001最多但不包括选择所有文本行part2=002.
到目前为止,我有:
var res = (from line in File.ReadAllLines(sExecPath + @"\" + sFileName)
where line == "part1=001"
select line).ToList();
Run Code Online (Sandbox Code Playgroud)
我试图在linq中使用选项之间,它似乎没有返回任何结果.
var part1= (from prt in File.ReadAllLines(sExecPath + @"\" + sFileName)
where prt.CompareTo("part1=001") >=0
&& prt.CompareTo("part=002") >= 0
select prt);
Run Code Online (Sandbox Code Playgroud) 我试图找到一种简单的方法来复制插入符号当前所在的单词.我知道我可以选择单词的前面:按v e y.但这看起来很疯狂,我可以简单地按*上面的单词来搜索它,肯定有更好的方法来复制这个单词.也许甚至在一键按下?
如果我有一个被多次调用的方法,例如:
public int CalledManyTimes(int a, int b)
{
MyObject myObject = new myObject();
int c = a + b + myObject.GetSomeValue();
return c;
}
Run Code Online (Sandbox Code Playgroud)
通过放置MyObject myObject;方法之外是否有性能提升,所以它只声明一次,或者编译器会自动执行此操作吗?
结构究竟是如何传递的?
我传递一个Point结构的方法(点只包含INT的x,int y)对,这方法改变的值,并返回一个new Point(newX, newY);是更好地改变已传递到方法的点并返回?或者我可以创建一个Point point; 在我的第一个问题中提出的方法之外并使用它?
我有一个下面的LINQ查询,
public AddXferData DisplayXferDataToBeModified(int ID)
{
try
{
var resultSet = (from items in DataContext.Transfers
where items.Transfer_ID.Equals(ID)
select new AddXferData
{
XferID = items.Transfer_ID,
LogicalName = items.Logical_Name,
RoutCode = items.Route_Code,
Label = items.Label,
OnNetDNA = items.On_Net_DNA,
OnNetDNB = items.On_Net_DNB,
FailMessage = items.Failure_Message,
});
return resultSet;
}
catch (Exception ex)
{
throw ex;
}
}
Run Code Online (Sandbox Code Playgroud)
但是我的resultSet要求进行Cast,而我得到的消息是
“无法将类型'System.Linq.IQueryable'隐式转换为'ICMAdministration.Data.AddXferData'。存在显式转换(是否缺少转换?)
我需要转换结果集以键入AddXferData。您能告诉我如何实现吗?非常感谢您在这方面的帮助。
此致Raghu
我尝试将 IP 地址转换为长值:
byte[] Ip = new byte[4] { 192, 168, 1, 0 };
UInt32 Ret1 = (((UInt32)Ip[0]) << 24) |
(((UInt32)Ip[1]) << 16) |
(((UInt32)Ip[2]) << 8) |
(((UInt32)Ip[3]));
UInt32 Ret2 = BitConverter.ToUInt32(Ip, 0);
Run Code Online (Sandbox Code Playgroud)
Ret1返回3232235776(正确值)
Ret2 返回108736(?)
为什么会出现这种差异?
我想通过识别具有我正在寻找的特定模式的文件夹来删除文件夹中的文件夹...例如,如果有6个文件夹如下,我想删除模式具有字符串"-dated"作为文件夹名称的一部分的文件夹...可以帮助我如何在批处理文件中执行此操作
1 . "target-dated-29sep"
2 . "target-dated-28sep"
3 . "target"
4 . "target-dated-27sep"*
5 . "BIN"
Run Code Online (Sandbox Code Playgroud) c# ×7
linq ×2
winforms ×2
.net-4.0 ×1
batch-file ×1
bitconverter ×1
cmd ×1
combobox ×1
copy-paste ×1
data-binding ×1
directory ×1
matching ×1
mvvm ×1
optimization ×1
silverlight ×1
vi ×1
vim ×1
windows ×1