[Solved] C# how xmlreader read attributes element value

[ad_1] With huge xml files I use combination of XML Reader and XML Linq using System; using System.Linq; using System.Text; using System.Collections; using System.Collections.Generic; using System.Xml; using System.Xml.Linq; namespace ConsoleApp2 { class Program { const string FILENAME = @”c:\temp\test.xml”; static void Main(string[] args) { XmlReader reader = XmlReader.Create(FILENAME); while(!reader.EOF) { if (reader.Name != “Subject”) { … Read more

[Solved] Get object in LINQ expression

[ad_1] You could try collecting every db entry that matches your criteria first public static IEnumerable<string> GetFiles(List<string> srcFiles) { var filePaths = new List<string>(); using (var db = new ContentMgmtContext()) { foreach (var fileInfo in srcFiles.Select(file => new FileInfo(file))) { var matches = db.Files.Where(o => o.FileName.ToLower() == fileInfo.Name.ToLower() || o.FileSize == fileInfo.Length.ToString()) if (matches.Count() > … Read more

[Solved] Please check my Regex to match color text [closed]

[ad_1] but i have a problem whit performance this.Dispatcher.Invoke invokes back to the GUI thread…which doesn’t do any good if you want the work to not hamper the user. You need to separate out the what the regex’es find, from the how to display it to the user. Running the regex’es in separate threads is … Read more

[Solved] Error: Segmentation Fault 11 in Palindrome

[ad_1] I couldn’t understand some of your code it seemed you were doing some unnecessary things. What was msg for? This should work if I understood your problem correctly: #include <stdio.h> #include <string.h> void palindrome_check(int ch_length, char text []); int main(void) { char text [100]; /* int length; printf(“Enter how many characters are in the … Read more

[Solved] How to draw a line from two points? [closed]

[ad_1] By using Graphics.DrawLine, for example: public void DrawLinePoint(PaintEventArgs e) { // Create pen. Pen blackPen = new Pen(Color.Black, 3); // Create points that define line. Point point1 = new Point(100, 100); Point point2 = new Point(500, 100); // Draw line to screen. e.Graphics.DrawLine(blackPen, point1, point2); } See MSDN for more info: https://msdn.microsoft.com/en-us/library/f956fzw1(v=vs.110).aspx [ad_2] solved … Read more

[Solved] Re-prompting a user until he/she enters a positive integer value greater than 1

[ad_1] You can solve this by reading a string first, and then extracting any number: #include <stdio.h> int main(void) { int length = 0; char input[100]; while(length <= 0) { printf(“Enter length: “); fflush(stdout); if(fgets(input, sizeof input, stdin) != NULL) { if(sscanf(input, “%d”, &length) != 1) { length = 0; } } } printf(“length = … Read more