小编Sku*_*uta的帖子

有没有机会使用Linq(C#)获得独特的记录?

我有一个 list<list<string>>

in list[x][0]是我想要选择唯一记录的记录,因此这样的记录不会出现在任何其他记录中list[x][0,当我选择它时,我想要选择整行list[x].我没有在Linq找到适当的这个例子,请帮忙:(

编辑

当Jon Skeet要求我澄清时,我不能否认;-)

list<list<string>>
Run Code Online (Sandbox Code Playgroud)

包含字符串表的列表.每个字符串"table"包含几个键list[x][several_items],我想从list->中获取唯一记录,这意味着该"表"中的FIRST项.

从而:

item[0] = "2","3","1","3"
item[1] = "2","3","4","2"
item[3] = "10","2"
item[4]= "1","2"
Run Code Online (Sandbox Code Playgroud)

- > unique意味着我可以将行派生item[3] and item[4]为唯一的.因为第一次出现数字/字符串很重要.

如果有2个或更多记录/行(item[x] of which first item (item[x][0])在列表中存在多次,则它不是唯一的.

每个列表的第一个元素对于确定唯一性很重要.也许如果有人可以帮助找到找到非唯一的方法会更容易 - >所以从上面的例子中我只得到item [0]和item [1]

c# linq unique

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

如何使用C#(.NET)中的POST变量登录HTML表单?

例如,有这个网站:www.azet.sk

在右边,有登录名和密码,我希望我的应用程序登录到这个Web应用程序并从我自己的帐户检索数据到C#(.NET)应用程序并使用它.目的是使"登录"连接保持活动状态并使用POST方法发送变量.是否有任何教程或简单的脚本与示例来学习这个?

html c# forms post logging

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

如何在C#中最大化我的应用程序使用的功率?

因为我已经创建了很难进行计算的应用程序 - >要做很多工作,而不是非常复杂的计算 - >它需要很长时间才能完成,并且该过程仅占CPU的45%.我能以某种方式最大化它吗?:达到90%?

c# cpu process maximize

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

如何根据List <string>字段数对List <List <string >>进行排序?

如何根据字段数对List <List <string >>进行排序?

列表得到了结构

a|b|c|d|eeee|rere|ewew|
ewqewq|ewew|
ewew|ewewewewew|
Run Code Online (Sandbox Code Playgroud)

按排序我想根据块数(asc/desc)来做

编辑

<list<list<string>> is "items"我访问由项每个列表[0]的每

这些项[xx]是一个列表,这意味着我希望它们对数组进行排序

    a|b|c|d|eeee|rere|ewew|
    a|b|c|d|eeee|rere
    a|b|c|d|eeee
Run Code Online (Sandbox Code Playgroud)

c# sorting list

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

这是MySQL中更新查询的正确方法吗?

我在php/mysql应用程序中找到一个bug时遇到了一些问题,我想知道我是否可以这样做:UPDATE table SET userid='2' WHERE userid='1'- >我可以更新我在WHERE中声明的内容吗?

mysql sql-update

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

为什么我的数组抛出超出范围的异常错误?

为什么以下代码会抛出异常?

for (int i = 0; i <= Items.Length-1; i++)
{
    Console.WriteLine(Items[i,1]);
}
Run Code Online (Sandbox Code Playgroud)

例外:

System.IndexOutOfRangeException was unhandled
  Message="Index was outside the bounds of the array."
  Source="Es"
  StackTrace:
       at Es.Program.Main(String[] args) in C:\Users\Fero\Documents\Visual Studio 2005\Projects\Es\Es\Program.cs:line 19
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
Run Code Online (Sandbox Code Playgroud)

物品声明:

获取字符串数组的函数:

static string[,] ReadFromFile(string filename, int rowsF)
{
    StreamReader SR;
    string S;
    string[] S_split;

    SR = File.OpenText(filename);
    S = SR.ReadLine();

    string[,] myItems = new String[rowsF, 2];
    int row_number …
Run Code Online (Sandbox Code Playgroud)

c# arrays

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

isprefix比在C#中比较两个字符串更昂贵吗?

我正在做一些比较两个字符串的计算.如果我知道它们长度相同,那么调用isprefix或If("string"=="string")是否更昂贵?

c# string comparison

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

通过在行中查找值来获取列

在Excel中,我一直看着hlookup,vlookup,matchindex,但没有这些功能做到以下几点:

我需要找到一个文本值A1:Z1并获取它的列.例如,我找到了值F1,然后我想要一个结果F:F.

编辑:这是我希望它添加到的功能:

=COUNTIFS(Source!B:B;Result!C3;Source!AT:AT;Result!$D$2)
Run Code Online (Sandbox Code Playgroud)

我需要Source!B:B,或者Source!AT:AT是一个搜索函数,在我的表行和列中查找不同表单(源)中的特定值.

excel excel-formula

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

如何有效地生成2个字符的长字?

我一直在想着制作一个脚本,用我语言中给定的一组字符生成2个字符的单词.但是,由于我没有重新发明轮子,你知道C#公开可用的这样一个脚本吗?

c# string

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

如何在IE中解决TInyMCE的问题?

我得到这个代码来改变textareas使用TinyMCE作为编辑器.它在Firefox中运行良好,但IE显示了带有代码的简单textarea.有人可以帮我做什么吗?

  print("<script language=\"javascript\" type=\"text/javascript\" src=\"jscripts/tiny_mce/tiny_mce.js\"></script>");


  echo('<script type="text/javascript">tinyMCE.init({   theme : "advanced", mode : "textareas",
   plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",

        theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
        theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
        theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
        theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_statusbar_location : "bottom",
        theme_advanced_resizing : "true",
   });</script>');
  echo("</head>\n");
Run Code Online (Sandbox Code Playgroud)

这就是IE所说的(代码):

<script language="javascript" type="text/javascript" src="jscripts/tiny_mce/tiny_mce.js"></script><script type="text/javascript">tinyMCE.init({ theme : "advanced", mode : "textareas",
   plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",

        theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
        theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
        theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
        theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_statusbar_location : "bottom",
        theme_advanced_resizing : …
Run Code Online (Sandbox Code Playgroud)

internet-explorer tinymce

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

如何计算1D阵列如果我无法预测它的长度?

重复

C#中未知长度的数组

如何在不需要初始化长度的情况下初始化string []?我希望它是动态数组,所以当我添加一些东西时,长度增加并且没有异常提升?

我应该使用某种List吗?

c# arrays initialization

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

如何根据C#中的List <UInt32> [0]编号ASC/DESC对List <List <UInt32 >>进行排序?

如何按ASC顺序排序?

List<List<UInt32>>记录了很多List<UInt32>,我希望根据每条记录中的第一列对这些记录进行排序 - 该列是UInt32编号.

所以:

我有以下列表:

new List<UInt32>: 32,1,1,1,1,1
new List<UInt32>: 22,2,2,2,2,2
new List<UInt32>: 32,1,1,1,1,1
new List<UInt32>: 1,1,1,1,1
Run Code Online (Sandbox Code Playgroud)

应该分类到:

List<UInt32>: 1,1,1,1,1
List<UInt32>: 22,2,2,2,2,2
new List<UInt32>: 32,1,1,1,1,1
new List<UInt32>: 32,1,1,1,1,1
Run Code Online (Sandbox Code Playgroud)

- >只有第一个数字!其他对排序不重要.我正在寻找ASC的东西,但两者都很棒,所以当我认为算法应该改变时,我会查找它:)

感谢您的帮助!

@Samuel,谢谢,当我尝试更改类型时,我会尝试实现它:)

c# sorting list uint32

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

在删除某些时间后,是否可以让List崩溃?

假设有一个列表 List<UInt32>

因此,:

12|12
23|33
33|22
11|22
Run Code Online (Sandbox Code Playgroud)

我需要删除第0和第2个元素(List<UInt32>).但是,当我尝试foreach这个列表并首先删除0时,List折叠其元素,1st现在变为0 ..所以我不想删除错误的元素,因为我的另一个List<int>包含我想要删除的元素的位置.

无论如何,我想为此做一些算法,但我想知道是否已经解决了这个问题.

c# list

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