小编use*_*071的帖子

什么是.Net框架上的clr.dll,它有什么作用?

我在VS2012上使用分析工具,看看clr.dll工作了很多时间.是垃圾收集?clr.dll可以做什么?请告诉我.谢谢!

.net c# clr profiler garbage-collection

16
推荐指数
2
解决办法
2万
查看次数

它可以返回null吗?(this.Result == Result.OK)

这段代码可以返回null吗?

(this.Result == Result.OK)
Run Code Online (Sandbox Code Playgroud)

这行(或类似的行)可以返回除trueor 之外的任何内容false(例如null)吗?

c# null return

10
推荐指数
3
解决办法
1187
查看次数

通过c#创建xml rootNode

我想像这样创建一个 xml 文档和根元素:

<rdf:RDF xmlns:cim="http://iec.ch/TC57/2009/CIM-schema-cim14#"

xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
Run Code Online (Sandbox Code Playgroud)

我尝试像这样创建:

 XmlDocument doc = new XmlDocument();
        XmlNode rootNode = doc.CreateElement("rdf:RDF xmlns:cim="http://iec.ch/TC57/2009/CIM-schema-cim14#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">");
        doc.AppendChild(rootNode);

        XmlNode userNode = doc.CreateElement("user");
        XmlAttribute attribute = doc.CreateAttribute("age");
        attribute.Value = "42";
        userNode.Attributes.Append(attribute);
        userNode.InnerText = "John Doe";
        rootNode.AppendChild(userNode);

        userNode = doc.CreateElement("user");
        attribute = doc.CreateAttribute("age");
        attribute.Value = "39";
        userNode.Attributes.Append(attribute);
        userNode.InnerText = "Jane Doe";
        rootNode.AppendChild(userNode);

        doc.Save("C:/xml-test.xml");
Run Code Online (Sandbox Code Playgroud)

但我有例外:' ' 字符,十六进制值 0x20,不能包含在名称中。 或者等等。

如何制作这个元素?谢谢。

c# xml

5
推荐指数
1
解决办法
2万
查看次数

如何在TFS上描述WorkItem状态变化?

美好的一天!

我想知道,如何在TFS 2010\2013上描述WorkItem状态更改?

我应该使用WCF吗?

请告诉我们的方式.

谢谢.

PS我需要通过c#访问tfs workitem更改:当workitem更改时 - 我想获得一些通知并通过c#进行一些操作

例如:我有控制台程序,所有的工作项目.但它通过运行sheduler得到.我想在onWorkItemChanged这样的事件上订阅我的程序:当一些用户改变任务程序时,改变它并做一些工作.

c# tfs workitem

4
推荐指数
1
解决办法
3395
查看次数

通过c#解析csproj - 无法解析ItemGroup

我试图从csproj文件中获取所有dll名称,但无法得到任何东西!所以,我尝试使用liq查询从ItemGroup标签获取al元素:

 var elem = doc.Descendants("Project").Where(t => t.Attribute("ToolsVersion")!=null)
                .Elements("ItemGroup").Elements("Reference").Where(r => r.Attribute("Include") != null);
            var attrs = elem.Attributes();
            Console.WriteLine(attrs.Count());
            foreach (var e in attrs)
            {
                Console.WriteLine(e);
            }
Run Code Online (Sandbox Code Playgroud)

这是我的xml csproj文件.我剪了一些不成熟的文字))

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

 <ApplicationIcon>icon.ico</ApplicationIcon>
 </PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Xaml">
    <RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="MyProject1" />
<Reference Include="MyProject2" />
<Reference Include="MyProject3" />
 </ItemGroup>
 </Project>
Run Code Online (Sandbox Code Playgroud)

请帮我拿这个名单!我做错了什么? …

c# xml linq csproj

3
推荐指数
1
解决办法
1222
查看次数

语法的语言与语音识别器的语言不匹配

美好的一天!它是关于Microsoft Server Speech SDK v11.0(服务器版本).

我在MSDN示例中运行了测试示例.所以英语短语-red,blue--很好.但我也想识别俄语 - 安装微软语音识别语言-TELE(ru-RU)并运行我的app /

码:

 static void DoWork()
    {

        Thread.CurrentThread.CurrentCulture = new CultureInfo("ru-RU");
        Thread.CurrentThread.CurrentUICulture = new CultureInfo("ru-RU");

        // Create a new SpeechRecognitionEngine instance.
        SpeechRecognitionEngine sre = new SpeechRecognitionEngine();

        // Configure the input to the recognizer.
        sre.SetInputToWaveFile(@"c:\Test\???????.wav");

        // Create a simple grammar that recognizes "red", "green", or "blue".
        Choices colors = new Choices(); 
       // colors.Add(new string[] { "red", "green", "blue","???????" });
        colors.Add(new string[] { "???????" }); //russian word- "red"

        // Create a …
Run Code Online (Sandbox Code Playgroud)

c# speech-recognition microsoft-speech-platform

3
推荐指数
2
解决办法
6125
查看次数

如何在 ICSharpCode.AvalonEdit.TextEditor 中更改文本颜色?

再会!

我正在尝试制作简单的代码编辑器,因此我希望能够选择文本行并将其颜色更改为红色,使用ICSharpCode.AvalonEdit.TextEditor.

但我不知道如何使用它。你能帮我改变文本行的颜色吗?

谢谢你!

c# wpf icsharpcode avalonedit

3
推荐指数
1
解决办法
4119
查看次数

语音识别在此系统上不可用.无法找到SAPI和语音识别引擎

美好的一天!我尝试使用Speech SDK 11编写简单的语音到文本引擎.所以尝试从这个例子执行测试.

所以,我只是创建控制台应用程序并运行代码.(有任务)

 Task speechRecognizer = new Task(DoWork);
        speechRecognizer.Start();
        speechRecognizer.Wait();

static void DoWork()
    {

        // Create a new SpeechRecognitionEngine instance.
        SpeechRecognitionEngine sre = new SpeechRecognitionEngine();

        // Configure the input to the recognizer.
        sre.SetInputToWaveFile(@"c:\Test\Colors.wav");

        // Create a simple grammar that recognizes "red", "green", or "blue".
        Choices colors = new Choices();
        colors.Add(new string[] { "red", "green", "blue" });

        // Create a GrammarBuilder object and append the Choices object.
        GrammarBuilder gb = new GrammarBuilder();
        gb.Append(colors);

        // Create the Grammar instance and load …
Run Code Online (Sandbox Code Playgroud)

c# microsoft-speech-platform

2
推荐指数
1
解决办法
1632
查看次数

如何在 RichTextBox 中更改部分文本颜色

再会!

我尝试将部分文本更改为红色。

所以,我尝试使用 TextBox,但它不起作用。所以,我读到 RichTextBox 可以做到这一点:我使用这个问题

但我不知道如何附加彩色文本?

  TextRange rangeOfText1 = new TextRange(tbScriptCode.Document.ContentEnd,    tbScriptCode.Document.ContentEnd);
 rangeOfText1.Text = "Text1 ";
rangeOfText1.ApplyPropertyValue(TextElement.ForegroundProperty, Brushes.Blue);
                             rangeOfText1.ApplyPropertyValue(TextElement.FontWeightProperty, FontWeights.Bold);
Run Code Online (Sandbox Code Playgroud)

好的,我得到了 TextRange,但是如何将它附加到 RichTextBox?

你能告诉我如何将文本的某些部分变成红色吗?谢谢!

c# wpf textbox colors richtextbox

2
推荐指数
1
解决办法
3247
查看次数

如何通过C#从TFS获取所有工作项

美好的一天!

我尝试从TFS(2010)的集合中获取所有WorkItems。我找到了 带有一些代码示例的博客,但效果不佳:

ICommonStructureService Iss = (ICommonStructureService)projCollection.GetService(typeof(ICommonStructureService));
Run Code Online (Sandbox Code Playgroud)

此行代码返回错误-无法连接到TFS(同一代码连接良好)。好的,我尝试重写此代码并尝试执行此操作(来自msdn的另一个工作示例):

private static String _tfsURI ="http:tfsServer:port/tfsUrl"
static void Main(string[] args)
    {
        // Connect to Team Foundation Server
        //     Server is the name of the server that is running the application tier for   Team Foundation.
        //     Port is the port that Team Foundation uses. The default port is 8080.
        //     VDir is the virtual path to the Team Foundation application. The default path is tfs.
        Uri tfsUri = (args.Length < 1) ? …
Run Code Online (Sandbox Code Playgroud)

c# tfs workitem

1
推荐指数
1
解决办法
5535
查看次数