草庐IT

member-enumeration

全部标签

vb.net - CodeDom编译错误 'Forms' is not member of 'Windows' in Windows 8.1

我正在使用CodeDom创建InMemoryexe。这适用于Windows8及以下版本。如果我删除表单声明,编译后的代码在Windows8.1中工作,但我不想这样做。有任何想法吗?Windows7-一切正常,Windows8-一切正常,Windows8.1-无需声明表单即可工作。引用框架provOptions.Add("CompilerVersion","v4.0")CodeDom引用程序集:vbParams.ReferencedAssemblies.Add("mscorlib.dll")vbParams.ReferencedAssemblies.Add("System.dll")vb

c# - "Add-Member"到一个类型,而不仅仅是 PowerShell 中该类型的对象

在PowerShell中,您可以扩展对象:TheAdd-Membercmdletletsyouaddmembers(propertiesandmethods)toaninstanceofaWindowsPowerShellobject.Forexample,youcanaddaNotePropertymemberthatcontainsadescriptionoftheobjectoraScriptMethodmemberthatrunsascripttochangetheobject.但是:Thepropertiesandmethodsthatyouaddareaddedonlyto

c - 'st_blksize' : is not a member of 'stat' on Windows

因为我想从Linux移植到Windows。我意识到Windows和LinuxAPI都有stat.h但有一些不同。问题是Windowsstat.h没有st_blksize变量,但Linux有。我真的不明白st_blksize也可以做什么。谁能帮我解决这个问题?如何在Windows上找到与st_blksize等效的内容? 最佳答案 对于Linux结构定义,请访问此处:http://pubs.opengroup.org/onlinepubs/7908799/xsh/sysstat.h.html主要摘录:st_size:文件大小(以字节为单

c++ - Windows 驱动内核 : How enumerate all subdirectories and files?

我在一个小型的antirootkit中工作,我需要添加一个功能:删除rootkit目录和您可能的子目录中的所有文件。那么,首先有必要知道所有这些目录和文件,对吧?为此,我下面的代码已经完成了这项任务的一半。他枚举了特定目录的所有目录和文件,但不“查看”子目录(文件和文件夹)。例如:输出:代码:#includetypedefunsignedintUINT;NTSTATUSEnumFilesInDir(){HANDLEhFile=NULL;UNICODE_STRINGszFileName={0};OBJECT_ATTRIBUTESOa={0};NTSTATUSntStatus=0;IO_S

c# - 如果任何参数为空,为什么 Enumerable.SequenceEqual 会抛出异常?

我正在尝试使用Enumerable.SequenceEqual(x,y)因为我希望它基于Object.Equals(x,y)方法,如果x或y为null,则返回false,如果两者均为null(对于null情况),则返回true。但是,如果任何参数为null引用,Enumerable.SequenceEqual(x,y)将抛出异常,如果给它两个null,则不会返回true。在我的代码中,我经常检查集合相等性,所以我创建了一个方法来模拟序列的Object.Equals行为,但我只是想知道这种默认行为背后的逻辑是什么,并且可能有一个现有方法没有空值异常? 最佳答案

c# - 为什么 Enumerable.Empty() 返回一个空数组?

我希望Enumerable.Empty()的实现是这样的:publicstaticIEnumerableEmpty(){yieldbreak;}但是实现是这样的:publicstaticIEnumerableEmpty(){returnEmptyEnumerable.Instance;}internalclassEmptyEnumerable{privatestaticvolatileTElement[]instance;publicstaticIEnumerableInstance{get{if(EmptyEnumerable.instance==null)EmptyEnumerab

c# - List<T>.Enumerator 的 Reset 方法的行为

以下两种方法(一种使用IEnumerator,另一种使用List.Enumerator)即使看起来相同会产生不同的结果。staticvoidM1(){varlist=newList(){1,2,3,4};IEnumeratoriterator=list.GetEnumerator();while(iterator.MoveNext()){Console.Write(iterator.Current);}iterator.Reset();while(iterator.MoveNext()){Console.Write(iterator.Current);}}staticvoidM2(){

c# - 如何解决 Enumerable 和 MoreLINQ 之间不明确的 ZIP 调用?

我遇到了扩展方法解析的问题。LINQ和MoreLINQ包含zip方法,它自4.0版本以来就存在于.NET中,并且始终在MoreLINQ中。图书馆。但是您不能使用带有旧式扩展方法语法的实现之一。所以这段代码不会编译usingMoreLinq;usingSystem.Linq;varstudents=new[]{"Mark","Bob","David"};varcolors=new[]{"Pink","Red","Blue"};students.Zip(colors,(s,c)=>s+c);错误:Thecallisambiguousbetweenthefollowingmethodsorp

c# - 为什么 Enumerable.Except 返回不同的项目?

刚刚花了一个多小时调试我们代码中的一个错误,最终证明是关于Enumerable.Except的错误。我们不知道的方法:varilist=new[]{1,1,1,1};varilist2=Enumerable.Empty();ilist.Except(ilist2);//returns{1}asopposedto{1,1,1,1}或更一般地说:varilist3=new[]{1};varilist4=new[]{1,1,2,2,3};ilist4.Except(ilist3);//returns{2,3}asopposedto{2,2,3}查看MSDN页面:Thismethodretur

c# - LINQ to Entities/LINQ to SQL : switching from server (queryable) to client (enumerable) in the middle of a query comprehension?

在许多情况下,我想在服务器端进行一些过滤(有时是投影),然后切换到客户端以执行LINQ提供程序本身不支持的操作。天真的方法(这基本上就是我现在所做的)是将其分解为多个查询,类似于:varfromServer=fromtincontext.Tablewheret.Col1=123wheret.Col2="blah"selectt;varclientSide=fromtinfromServer.AsEnumerable()wheret.Col3.Split('/').Last()=="whatever"selectt.Col4;但是,很多时候,这带来的代码/麻烦多于它的实际值(value)