草庐IT

value-type

全部标签

c# - 尝试打开 telerik 报告时出现 "Value cannot be null. Parameter name: instance"错误

在我的解决方案中,我有telerik报告,当尝试在VisualStudio2010设计器中打开它们时,我收到此错误:Valuecannotbenull.Parametername:instanceCallStackatSystem.ComponentModel.TypeDescriptor.AddAttributes(Objectinstance,Attribute[]attributes)atMicrosoft.VisualStudio.Design.VSDesignSurface.CreateDesigner(IComponentcomponent,BooleanrootDesig

c# - 有关结构实现接口(interface)时发生的情况的详细信息

我最近遇到了这个Stackoverflow问题:Whentousestruct?在里面,它有一个答案,说的有点深奥:Inaddition,realizethatwhenastructimplementsaninterface-asEnumeratordoes-andiscasttothatimplementedtype,thestructbecomesareferencetypeandismovedtotheheap.InternaltotheDictionaryclass,Enumeratorisstillavaluetype.However,assoonasamethodcalls

c# - 异步任务<IEnumerable<T>> 抛出 "is not an iterator interface type"错误

仅当我使用async时,下面的代码才会抛出isnotaniteratorinterfacetypeawait并包装IEnumerable与任务。如果我删除asyncawait,它将与IEnumerable>一起使用.privateasyncTask>>GetTableDataAsync(CloudTablecloudTable,TableQuerytableQuery)whereT:ITableEntity,new(){TableContinuationTokencontineousToken=null;do{varcurrentSegment=awaitGetAzureTableDa

c# - 是否有任何有值(value)的 CSLA 替代品可用?

我的公司有兴趣将大型业务应用程序移植到.NET。我们计划开发桌面版和silverlight版。我主要研究了CSLA框架(得到了rocky的书,已经读了一半)并发现它有点过度设计,数据层方面似乎也没有那么完善。有没有其他框架声称可以做CSLA正​​在做的事情?我不是在谈论ORM工具(例如L2S、EF、NHibernate)。我感兴趣的是支持业务规则的框架、简单的n层架构、对象是域驱动的而不是数据库驱动的、业务对象的安全性等...我知道我可以找到小型框架来完成一些所需的工作(我想到了EnterpriseApplicationBlock),但我正在寻找一个包含所有内容的框架。

c# - 旧格式或无效类型库。 (来自 HRESULT : 0x80028018 (TYPE_E_INVDATAREAD)) 的异常

这个问题在这里已经有了答案:Microsoft.Office.Interop.Exceldoesn'tworkon64bit(1个回答)关闭8年前。将数据GridView中的数据导出到Excel工作表时出现错误:error(Oldformatorinvalidtypelibrary.(ExceptionfromHRESULT:0x80028018(TYPE_E_INVDATAREAD)))在这一行:Microsoft.Office.Interop.Excel._Workbookworkbook=app.Workbooks.Add(Type.Missing);我该如何解决这个问题?我的完

C# 反射 : how to get an array values & length?

FieldInfo[]fields=typeof(MyDictionary).GetFields();MyDictionary是一个静态类,所有字段都是字符串数组。如何获取每个数组的长度值,然后遍历所有元素?我尝试了这样的类型转换:fieldasArray但它会导致错误Cannotconverttype'System.Reflection.FieldInfo'to'System.Array'viaareferenceconversion,boxingconversion,unboxingconversion,wrappingconversion,ornulltypeconversion

c# - 编译器错误 : "error CS0307: The variable ' int' cannot be used with type arguments"

如果我有以下代码:privatevoidCheck(boola,boolb){}privatevoidCheck(inta,intb,intc,boolflag){Check(a(flag?c:b-10));}我在调用Check(int,int)时遇到编译时错误:errorCS0307:Thevariable'int'cannotbeusedwithtypearguments我也遇到了这些错误:errorCS0118:'b'isavariablebutisusedlikeatypeerrorCS0118:'a'isavariablebutisusedlikeatype为什么会出现这些错

c# - .NET 值类型在内存中的布局

我有以下.NET值类型:[StructLayout(LayoutKind.Sequential)]publicstructDate{publicUInt16V;}[StructLayout(LayoutKind.Sequential)]publicstructStringPair{publicStringA;publicStringB;publicStringC;publicDateD;publicdoubleV;}我的代码将指向值类型的指针传递给非托管代码,以及通过调用System.Runtime.InteropServices.Marshal.OffsetOf发现的偏移量。非托管代

c# - Type.GetType 返回 null

这个问题在这里已经有了答案:Type.GetType("namespace.a.b.ClassName")returnsnull(17个答案)关闭7年前。我正在尝试使用Type.GetType并传递“caLibClient.entity.Web2ImageEntity”完整类名。caLibClient.entity是命名空间,位于单独的程序集(caLibClient)中并添加到程序引用程序集列表中。当我从程序中调用Type.GetType时,它​​总是返回Null,有什么问题吗?

c# - Resharper 中的警告 "Return value of pure method is not used"

我有一个快速的问题,关于我正在工作的c#项目中从VisualStudio中的Resharper收到的警告。警告是:"ReturnValueofpuremethodisnotused"发生这种情况的方法如下:privatestaticboolFilePathHasInvalidChars(stringuserInputPath){try{//thisiswherethewarningoccurs:Path.GetFullPath(userInputPath);}catch(Exceptione){Log.Error(String.Format("TheProgramfailedtorun