草庐IT

dependent-type

全部标签

c# - "The invocation of the constructor on type ' TestWPF.MainWindow ' that matches the specified binding constraints threw an exception."- 如何解决这个问题?

我正在使用WPF。当我试图在代码中声明SQLiteConnection时,问题出现了-Theinvocationoftheconstructorontype'TestWPF.MainWindow'thatmatchesthespecifiedbindingconstraintsthrewanexception.InnerException:Makesurethatthefileisavalid.NETFrameworkassembly.谁能告诉我,如何解决? 最佳答案 如果您在异常窗口中单击查看详细信息...,您可以查看InnerE

c# - 奇怪的 : C# Type or Namespace name could not be found - Builds successfully

当我的项目在VS2012IDE中打开时,我的项目中出现了一个奇怪的错误。在我使用另一个引用项目的任何地方,它都会突然显示“找不到类型或命名空间名称”。我所说的“说”是指当我将鼠标悬停在它上面时,它的文本带有红色下划线并带有错误。智能感知不适用于该代码。但是(这是奇怪的部分),错误没有显示在错误控制台中,项目构建并运行良好。我什至可以调试和单步调试代码,它工作得非常好。因此,在运行时项目被很好地引用,但在设计时IDE无法找到它。这在过去的2周内一直有效,然后才突然变得有点疯狂。这真的很烦人,因为我在没有智能感知的情况下编码很垃圾!有没有人见过这样的事情或有什么建议?

c# - 奇怪的 : C# Type or Namespace name could not be found - Builds successfully

当我的项目在VS2012IDE中打开时,我的项目中出现了一个奇怪的错误。在我使用另一个引用项目的任何地方,它都会突然显示“找不到类型或命名空间名称”。我所说的“说”是指当我将鼠标悬停在它上面时,它的文本带有红色下划线并带有错误。智能感知不适用于该代码。但是(这是奇怪的部分),错误没有显示在错误控制台中,项目构建并运行良好。我什至可以调试和单步调试代码,它工作得非常好。因此,在运行时项目被很好地引用,但在设计时IDE无法找到它。这在过去的2周内一直有效,然后才突然变得有点疯狂。这真的很烦人,因为我在没有智能感知的情况下编码很垃圾!有没有人见过这样的事情或有什么建议?

报错:RuntimeError: expected scalar type Double but found Float

这个问题是深度学习,用pytorch跑的时候出现的解决办法:这个是格式问题,希望的格式是double,但得到的是float。字面意思是这个,但是并不是非要把格式改成double,这个时候应该在出错的前面几处代码设个断点debug一下,我得到的结果是image、img_rgb都是tensor.unit8格式的,但程序所需要的是torch.float32格式的,因此在这两行后面加上.float()即可会出上述的错误,改成: 

c# - 检查 Type 或实例是否实现 IEnumerable 而不管类型 T

我正在对我当前的项目进行大量反射(reflection),我正在尝试提供一些辅助方法以保持一切整洁。我想提供一对方法来确定类型或实例是否实现了IEnumerable–无论类型T.这是我目前拥有的:publicstaticboolIsEnumerable(thisTypetype){return(typeisIEnumerable);}publicstaticboolIsEnumerable(thisobjectobj){return(objasIEnumerable!=null);}当我测试它们时使用Debug.WriteLine("TypeIEnumerable:"+typeof(I

c# - 检查 Type 或实例是否实现 IEnumerable 而不管类型 T

我正在对我当前的项目进行大量反射(reflection),我正在尝试提供一些辅助方法以保持一切整洁。我想提供一对方法来确定类型或实例是否实现了IEnumerable–无论类型T.这是我目前拥有的:publicstaticboolIsEnumerable(thisTypetype){return(typeisIEnumerable);}publicstaticboolIsEnumerable(thisobjectobj){return(objasIEnumerable!=null);}当我测试它们时使用Debug.WriteLine("TypeIEnumerable:"+typeof(I

c# - 指定的架构无效。错误 : The relationship was not loaded because the type is not available

我希望在我的Order模型中引用OrderAddress模型两次;一次作为ShippingAddress,一次作为BillingAdress。另一方面,我希望我的OrderAddress模型有一个OrderAddresses列表。OrderAddress模型publicenumAddressType{Billing,Shipping,Contact}publicclassOrderAddress:BaseModel{publicAddressTypeAddressType{get;set;}publicboolIsPrimary{get;set;}publicstringAddress

c# - 指定的架构无效。错误 : The relationship was not loaded because the type is not available

我希望在我的Order模型中引用OrderAddress模型两次;一次作为ShippingAddress,一次作为BillingAdress。另一方面,我希望我的OrderAddress模型有一个OrderAddresses列表。OrderAddress模型publicenumAddressType{Billing,Shipping,Contact}publicclassOrderAddress:BaseModel{publicAddressTypeAddressType{get;set;}publicboolIsPrimary{get;set;}publicstringAddress

c# - 反射.Net : how to load dependencies?

我尝试使用反射将插件系统添加到我的Windows.Net应用程序;但是当有依赖的插件时它会失败。插件类必须实现接口(interface)“IAddon”并具有一个空的构造函数。主程序使用反射加载插件:Assemblyassembly=Assembly.LoadFile(@"C:\Temp\TestAddon\Addon.dll");Typet=assembly.GetType("Test.MyAddon");ConstructorInfoctor=t.GetConstructor(newType[]{});IAddonaddon=(IAddon)ctor.Invoke(newobjec

c# - 反射.Net : how to load dependencies?

我尝试使用反射将插件系统添加到我的Windows.Net应用程序;但是当有依赖的插件时它会失败。插件类必须实现接口(interface)“IAddon”并具有一个空的构造函数。主程序使用反射加载插件:Assemblyassembly=Assembly.LoadFile(@"C:\Temp\TestAddon\Addon.dll");Typet=assembly.GetType("Test.MyAddon");ConstructorInfoctor=t.GetConstructor(newType[]{});IAddonaddon=(IAddon)ctor.Invoke(newobjec