草庐IT

question_type

全部标签

c# - "Inspecting the state of an object in the debuggee of type System.Reflection.MethodBase is not supported in this context"

我不知道这个错误是什么意思。我使用的是VisualStudioforMac7.5.0社区版。我在带有ASP.NETCore的EntityFramework中使用延迟加载。publicpartialclassAdminUser{publicAdminUser(){RoleAssign=newHashSet();}publicGuidUserId{get;set;}publicstringFirstName{get;set;}publicstringLastName{get;set;}publicstringEmail{get;set;}publicstringUserName{get;s

c# - 比 Dictionary<Type, X> 更快的选择?

我正在创建一个正在进行性能测试的库。在其中我生成了一个Dictionary一次。这些项目当前以随机顺序插入。字典在应用程序生命周期内保持不变。然后它经常用于查找项目。查找是库中较大的瓶颈之一。是的,我正在微观优化,但要学习。我想知道是否有更好的方法来获得查找性能?更新我使用dotTrace来衡量性能。报告+dotTrace在我的家用电脑中,所以我这里没有报告(本可以上传到其他地方)。我使用了这里的测试:https://github.com/danielpalme/IocPerformance字典定义可在此处找到:https://github.com/jgauffin/Griffin.C

c# - 如何找到asp :Login LoginError error type

当asp:Login控件的LoginError事件触发时,我如何找到错误发生的原因?是否有类似e.ErrorType的属性告诉我登录失败的原因?或者我是否必须像本教程中那样手动检查所有内容:http://www.asp.net/security/tutorials/validating-user-credentials-against-the-membership-user-store-cs或http://www.aspnettutorials.com/tutorials/controls/howto-errors-login-asp4-csharp.aspx

c# - 使用泛型类型参数代替 System.Type 类型的参数。是气味吗?

关闭。这个问题是opinion-based.它目前不接受答案。想要改进这个问题?更新问题,以便editingthispost可以用事实和引用来回答它.关闭3年前。Improvethisquestion我经常看到(例如在许多模拟库中)使用泛型类型参数代替System.Type类型参数的方法。我特别讨论的是泛型类型仅在typeof(T)操作中使用的情况(即,方法中的任何地方都没有使用类型T的实例,并且T没有被用于返回值类型或其他参数)。例如考虑以下方法:publicstringGetTypeName(System.Typetype){returntype.FullName;}这个方法通常伴

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# - 旧格式或无效类型库。 (来自 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# - 编译器错误 : "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# - Type.GetType 返回 null

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

c# - 如何解决错误 : Inconsistent accessibility: parameter type for generic c# interface?

将此代码写入我的项目时出现错误Error1Inconsistentaccessibility:fieldtype'System.Collections.Generic.List'islessaccessiblethanfield'Jain_milan.addchild.m_children'Error2Inconsistentaccessibility:parametertype'System.Collections.Generic.List'islessaccessiblethanmethod'Jain_milan.addchild.addchild(System.Collectio

C# 泛型 : cast generic type to value type

我有一个泛型类,它保存指定类型T的值。该值可以是int、uint、double或float。现在我想获取值的字节以将其编码为特定协议(protocol)。因此我想使用方法BitConverter.GetBytes()但不幸的是Bitconverter不支持泛型类型或undefinedobject。这就是为什么我要转换值并调用GetBytes()的特定重载。我的问题:如何将通用值转换为int、double或float?这不起作用:publicclassGenericClasswhereT:struct{T_value;publicvoidSetValue(Tvalue){this._va