草庐IT

using-size-classes-xcode

全部标签

c# - FileLoadException 在 InitializeComponent 或 x :Class=

我在InitializeComponent方法中遇到文件加载器异常(第一次机会),或者调试器在多个WPF的xaml-root的x:Class属性处中断用户控制。尽管异常会大大降低导航速度,但一切正常。这是异常信息:Couldnotloadfileorassembly'Company.Solution.UserInterface,Version=0.1.5568.25577,Culture=neutral,PublicKeyToken=45069ab0c15881ce'oroneofitsdependencies.Thelocatedassembly'smanifestdefinitio

c# - 代理设置设置为 "Use automatic configuration script"的 WCF 客户端

我目前正在开发一个需要与Internet上的Web服务通信的应用程序。InternetExplorer是迄今为止唯一通过代理服务器连接到Internet的应用程序。代理设置设置为“使用自动配置脚本”。我保留了默认设置另外设置但运气不好。我不断收到“(407)需要代理身份验证。”我已经进行了一些Google搜索,但解决方案似乎不适合我的情况。简短更新:该应用程序应使用默认用户凭据运行,并使用这些凭据通过NTLM向代理进行身份验证。但即使我将客户端设置为这样做,它似乎也无济于事。 最佳答案 保留设置,并确保useDefaultCrede

c# - 为什么具有 "where T : class"约束的 Generic<T> 方法接受接口(interface)

我有这个interface:publicinterfaceITestInterface{intTestInt{get;set;}}和这个通用方法(带有T:class约束):publicvoidTest()whereT:class{//DoSomething}这个电话:Test();一切都编译并运行,同时interface不是class(或者是吗?)。为什么会这样?我第一次看到这个是在我的WCF代理类上:publicpartialclassTestServiceClient:System.ServiceModel.ClientBase,TestNamespace.ITestService

c# - 代码契约(Contract) : Why are some invariants not considered outside the class?

考虑这个不可变类型:publicclassSettings{publicstringPath{get;privateset;}[ContractInvariantMethod]privatevoidObjectInvariants(){Contract.Invariant(Path!=null);}publicSettings(stringpath){Contract.Requires(path!=null);Path=path;}}这里需要注意两点:有一个保证Path属性永远不会为null的契约不变量构造函数检查path参数值以遵守先前的契约不变量此时,Setting实例永远不能有n

c# - 通过 using block 使用进程

这个问题在这里已经有了答案:关闭11年前。PossibleDuplicate:WhathappensifIdon'tcloseaSystem.Diagnostics.ProcessinmyC#consoleapp?由于System.Diagnostics.Process继承自实现IDisposable的Component,我是否应该始终创建一个Process使用usingblock?例如,这个...:using(varprocess=newProcess()){process.StartInfo.FileName="someprocess.exe";process.Start();pr

c# - 三重 DES : Specified key is a known weak key for 'TripleDES' and cannot be used

我正在使用.NET3.0类System.Security.Cryptography.MACTripleDES类来生成MAC值。不幸的是,我正在使用使用“1111111111111111”(十六进制)作为单一长度DESkey的硬件设备。System.Security.Cryptography库会对key进行完整性检查,如果您尝试使用加密强度较弱的key,则会返回异常。例如:byte[]key=newbyte[24];for(inti=0;i抛出异常System.Security.Cryptography.CryptographicException:Specifiedkeyisaknow

c# - "Data Source cannot be empty. Use :memory: to open an in-memory database"是什么意思?

我最近将我的SQLServer数据库转换为SQLite数据库。但是当我尝试使用.Open()打开我的SQLite时,它​​抛出了这个错误:DataSourcecannotbeempty.Use:memory:toopenanin-memorydatabase编辑:添加连接字符串:ConnectionString=@"DataSource=D:\XXX.db;Version=3";connection=newSQLiteConnection(connectionString);connection.Open();为什么我会得到这个?我将相同的SQLServer数据库转换为SQLCE和my

c# - Using block 中的异步

我在C#中有以下异步函数:privateasyncTaskCallDatabaseAsync(Func>execAsync){using(varconnection=newSqlConnection(_connectionString)){connection.Open();returnawaitexecAsync(connection);}}它允许执行任何异步函数execAsync,该函数将SQL连接作为参数并使用它来进行数据库调用,方法是提供连接对象并确保其正确关闭。然后从WebApiController中的操作调用此函数,如下所示:publicasyncTaskMyAction(

c# - 属性规范中奇怪的歧义(两个 using 指令)

背景在attributespecification,有时有两种有效的方法来编写应用的属性。例如,如果属性类的名称为HorseAttribute,您可以将该属性应用为[HorseAttribute]或只是[Horse]。歧义可以用@解决,例如[@Horse]。以下是一个有效的程序:usingSystem;usingAlpha;usingBeta;namespaceN{[Horse]classC{}}namespaceAlpha{//validnon-abstractattributetypewithaccessibleconstructorclassHorseAttribute:Attr

c# - Visual Studio express : free class diagram tool

关闭。这个问题不符合StackOverflowguidelines.它目前不接受答案。我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。关闭8年前。Improvethisquestion我正在使用c#express并希望使用免费工具来设计我的类图。您有什么推荐的免费工具?