c#-4.0

Remove all comments from XDocument

喜你入骨 提交于 2020-12-05 05:53:21
问题 I am working on reading XDocument. How can I remove all commented lines from XDocument. I have tried with doc.DescendantNodes().Where(x => x.NodeType == XmlNodeType.Comment).Remove(); But this removes only first level nodes with comments and inner level nodes remains as it is. Is there any way to remove all commented lines. I believe there must be!!! ;) Any Solutions. 回答1: Instead of the Where(x => x.NodeType == XmlNodeType.Comment) I would simply use OfType<XComment>() , as in doc

Convert Number Stored As Text To Number

喜你入骨 提交于 2020-12-03 03:38:24
问题 I have an Excel workbook that has column C as number stored as text. What is the C# syntax to convert it to number? I know that this VBA will do the job Range("C:C").Select With Selection Selection.NumberFormat = "0.00%" .Value = .Value End With And I tried this with C# - but it left the numbers stored as text. ExcelWorksheet ws3 = pck.Workbook.Worksheets.Add("New Sheet"); ws3.Cells["A1"].LoadFromDataTable(tableforme, true); ws3.View.FreezePanes(2, 4); ws3.Cells["C:C"].Style.Numberformat

Console application: How to update the display without flicker?

ぐ巨炮叔叔 提交于 2020-12-02 05:53:25
问题 Using C# 4 in a Windows console application that continually reports progress how can I make the "redraw" of the screen more fluid? I'd like to do one of the following: - Have it only "redraw" the part of the screen that's changing (the progress portion) and leave the rest as is. - "Redraw" the whole screen but not have it flicker. Currently I re-write all the text (application name, etc.). Like this: Console.Clear(); WriteTitle(); Console.WriteLine(); Console.WriteLine("Deleting:\t{0} of {1}

Console application: How to update the display without flicker?

空扰寡人 提交于 2020-12-02 05:53:11
问题 Using C# 4 in a Windows console application that continually reports progress how can I make the "redraw" of the screen more fluid? I'd like to do one of the following: - Have it only "redraw" the part of the screen that's changing (the progress portion) and leave the rest as is. - "Redraw" the whole screen but not have it flicker. Currently I re-write all the text (application name, etc.). Like this: Console.Clear(); WriteTitle(); Console.WriteLine(); Console.WriteLine("Deleting:\t{0} of {1}

Console application: How to update the display without flicker?

社会主义新天地 提交于 2020-12-02 05:53:11
问题 Using C# 4 in a Windows console application that continually reports progress how can I make the "redraw" of the screen more fluid? I'd like to do one of the following: - Have it only "redraw" the part of the screen that's changing (the progress portion) and leave the rest as is. - "Redraw" the whole screen but not have it flicker. Currently I re-write all the text (application name, etc.). Like this: Console.Clear(); WriteTitle(); Console.WriteLine(); Console.WriteLine("Deleting:\t{0} of {1}