Tag: C#的

exec任务需要一个命令执行的错误是什么意思?

在Visual Studio中编译项目时,出现错误消息“执行任务需要执行的命令”,没有行号。 这个错误是什么意思? (为了回答我自己的问题而抱歉,在写这篇文章的时候我刚刚find了一个答案,已经把它做成了社区wiki,以免冒犯。)

如何在DataGridView中禁用sorting?

我怎样才能禁用sorting在DataGridView ? 我需要禁用头DataGridViewsorting。

VS2015:警告MSB3884:找不到规则集文件

将我的WinForms VS2013项目升级到VS2015后,我开始看到MSB3884“无法find规则集文件”警告。 谷歌search出现了一篇MSDN文章,Stack Overflow文章以及其他许多网站。 类似的问题: 33020507 MSDN: VS2015 MSB3884警告 我已经安装了VS2013和VS2015。 给出警告的项目文件(以及那些没有的)没有这些条目。 <CodeAnalysisRuleSetDirectories> <CodeAnalysisRuleDirectories> 如果从项目文件中删除另外两个条目,则问题消失,这是显而易见的,因为没有规则文件集。 <CodeAnalysisIgnoreBuiltInRuleSets> <CodeAnalysisIgnoreBuiltInRules> 我正在尝试使用msbuild进行外部构build,但是VS2015也倾向于显示这个问题。 有趣的是,如果我点击项目属性代码分析器区域中的打开button,我得到的文件。 指定不同的规则集没有区别。 这让我觉得可能有一个环境variables设置,没有任何想到。 代码分析器是项目文件的一个function。 我可以添加一个目录属性,但共识是取出path, <CodeAnalysisRule*Directories> 。 GUI使用默认值: “ 这是一个典型的项目文件片段。 <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> <DebugSymbols>true</DebugSymbols> <OutputPath>bin\x86\Debug\</OutputPath> <DefineConstants>TRACE;DEBUG</DefineConstants> <DebugType>full</DebugType> <PlatformTarget>x86</PlatformTarget> <CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets> <CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules> <Prefer32Bit>false</Prefer32Bit> <TreatWarningsAsErrors>true</TreatWarningsAsErrors> <CodeAnalysisRuleSet>BasicCorrectnessRules.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> <DebugSymbols>true</DebugSymbols> <OutputPath>bin\x64\Debug\</OutputPath> <DefineConstants>TRACE;DEBUG</DefineConstants> <DebugType>full</DebugType> <PlatformTarget>x64</PlatformTarget> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules> </PropertyGroup> 没有摆脱项目文件中的代码分析线,虽然再次保存项目文件只是将其添加回来,我怎样才能消除/修复警告?

.NET扫描API

有没有用.NET编写的免费或商业组件(无COM互操作),可以与大多数的两台扫描仪一起使用?

入口点不能用“asynchronous”修饰符标记

我从这个链接复制下面的代码。但是当我编译这个代码时,我得到的入口点不能用'async'修饰符标记 。 我怎样才能使这个代码编译? class Program { static async void Main(string[] args) { Task<string> getWebPageTask = GetWebPageAsync("http://msdn.microsoft.com"); Debug.WriteLine("In startButton_Click before await"); string webText = await getWebPageTask; Debug.WriteLine("Characters received: " + webText.Length.ToString()); } private static async Task<string> GetWebPageAsync(string url) { // Start an async task. Task<string> getStringTask = (new HttpClient()).GetStringAsync(url); // Await the task. This is what […]

如何正确添加hex转义string文字?

当你在C中有string时,你可以在里面添加直接的hex代码。 char str[] = "abcde"; // 'a', 'b', 'c', 'd', 'e', 0x00 char str2[] = "abc\x12\x34"; // 'a', 'b', 'c', 0x12, 0x34, 0x00 这两个例子在内存中都有6个字节。 现在,如果要在hexinput后添加值[a-fA-F0-9] ,则存在问题。 //I want: 'a', 'b', 'c', 0x12, 'e', 0x00 //Error, hex is too big because last e is treated as part of hex thus becoming 0x12e char problem[] = "abc\x12e"; […]

在Eclipse / CDT中使用自定义Makefile

我有一个项目的多个.c和.h文件,我写我自己的生成文件。 我如何configurationEclipse使用我的生成文件和我的源文件从他们的原始位置?

ffmpeg.c什么是pts和dts? 这个代码块在ffmpeg.c中做什么?

简单地说,pts和dts的值是什么? 为什么在转码[解码 – 编码]video时它们很重要? 这个代码在ffmpeg.c中做了什么,它的目的是什么? 01562 ist->next_pts = ist->pts = picture.best_effort_timestamp; 01563 if (ist->st->codec->time_base.num != 0) { 01564 int ticks= ist->st->parser ? ist->st->parser->repeat_pict+1 : ist->st->codec->ticks_per_frame; 01565 ist->next_pts += ((int64_t)AV_TIME_BASE * 01566 ist->st->codec->time_base.num * ticks) / 01567 ist->st->codec->time_base.den; 01568 }

WPF中的文件select器对话框在哪里?

http://i.minus.com/i3xuoWZkpfxHn.png 我没有看到任何能够让我从计算机上select文件的东西…必须有一个,它在哪里? 我可能错过了一个参考? 编辑:我想到的是一个文本框旁边的“浏览”button。 现在我发现,我可能必须放置文本框和浏览button我自己,并添加一个单击事件button打开对话框…

检查一个属性是否存在于一个类中

我尝试了解一个类是否存在一个属性,我试过这个: public static bool HasProperty(this object obj, string propertyName) { return obj.GetType().GetProperty(propertyName) != null; } 我不明白为什么第一个testing方法不通过? [TestMethod] public void Test_HasProperty_True() { var res = typeof(MyClass).HasProperty("Label"); Assert.IsTrue(res); } [TestMethod] public void Test_HasProperty_False() { var res = typeof(MyClass).HasProperty("Lab"); Assert.IsFalse(res); }