[Solved] Replace xml node in c#

You mean something like this? XmlDocument xmlDoc = new XmlDocument(); XmlDocument xmlDoc2 = new XmlDocument(); xmlDoc.Load(xmlFile); xmlDoc2.Load(xmlFile2); XmlNode node = xmlDoc.SelectSingleNode(“Root/RuleDTO/RuleID”); XmlNode node2 = xmlDoc2.SelectSingleNode(“Root/RuleDTO[1]/RuleID”); XmlNode node3 = xmlDoc2.SelectSingleNode(“Root/RuleDTO[2]/RuleID”); if (node != null && node2 != null && node3 != null) node3.InnerText = node2.InnerText = node.InnerText; xmlDoc2.Save(xmlFile2); solved Replace xml node in c#

[Solved] Convert string date to another format C#? [closed]

Use DateTime.ParseExact: public string dateBirthday(string date) { DateTime a = DateTime.ParseExact(date, “dd.MM.yyyy”, CultureInfo.InvariantCulture); //return a.ToString(“dd/MM/yyyy”); // original answer without culture return a.ToString(“dd/MM/yyyy”, CultureInfo.InvariantCulture); } EDIT: As Jon Skeet already said, the / is culture-dependent and we (you and me;)) did not specify a culture for the ToString() function, so the culture of the host environment … Read more

[Solved] how can we solve this type? [closed]

Question is absolutely not clair… like this? private static Dictionary<String, PointPairList> s_PointPairLists = new Dictionary<String, PointPairList>(); private static void BuildPointPairLists(Int32 limit) { for (Int32 i = 2; i < limit; ++i) { if ((tabl[i].x != null) && (tabl[i].y != null)) { Double[] x = { 0, tabl[i].y }; Double[] y = { tabl[i].x, 0 }; … Read more

[Solved] C# – How Get days from given month with the previous/next days to fill List

Using this DateTime Extension: static class DateExtensions { public static IEnumerable<DateTime> GetRange(this DateTime source, int days) { for (var current = 0; current < days; ++current) { yield return source.AddDays(current); }; } public static DateTime NextDayOfWeek(this DateTime start, DayOfWeek dayOfWeek) { while (start.DayOfWeek != dayOfWeek) start = start.AddDays(-1); return start; } } In my Class … Read more

[Solved] General Questions about Entity Framework vs. Enterprise Library & a few others [closed]

I cannot answer all of your questions, but I will take a shot at a few of them (Question 1) Basically your assessment sounds right. It could also be said that EF ‘abstracts away’ the SQL that is otherwise needed to persist data to a persistent (generally a disk drive) store. (Question 7) Yes. However, … Read more

[Solved] C#-How to update a first row in DataTable based on dictionary values [closed]

You can try this one. var dictionary = new Dictionary<string, int>(); dictionary.Add(“pay_month”, 2); dictionary.Add(“pay_year”, 1); if (dt.Rows.Count > 0) { DataRow row = dt.Rows[0]; row[“Month”]=dictionary[“pay_month”]; row[“year”]=dictionary[“pay_year”]; } solved C#-How to update a first row in DataTable based on dictionary values [closed]

[Solved] How to make global variables? [closed]

Create singleton class so that instace can be created once and used across application public class Global { private static readonly Global instance = new Global(); public static Global Instance { get { return instance; } } Global() { } public string myproperty { get;set; } } Usage: Global.Instance.myproperty solved How to make global variables? … Read more

[Solved] type of variable in Visual C#

According to the documentation, it’s not returning a byte array but an Array. Just type ByteArray_to_Hex(problem) and let Visual Studio generate the method. Then you’ll see what type it returns. Perhaps you can call ByteArray_to_Hex((byte[])problem) to explicitly cast it. solved type of variable in Visual C#

[Solved] How to Map my input data [closed]

Code string str = “VALVE,GATE,SH_NAME:VLV,GATE,VLV_NOM_SIZE:4-1/16IN”; string[] Rows = str.Split(‘,’); dataGridView1.Columns.Add(“Column1”, “Column1”); dataGridView1.Columns.Add(“Column2”, “Column2”); foreach (string AddRow in Rows) { string[] Row = AddRow.Split(‘:’); dataGridView1.Rows.Add(Row); } 2 solved How to Map my input data [closed]

[Solved] Reading A Fixed Format Text File – Part 2

I ended up going with a slightly different solution. The solution to the “Could not find installable ISAM” exception was to use the following: string EXTENDED_PROPERTIES = @”Extended Properties=””Text;HDR=YES;FMT=FixedLength;”””; The key to the solution is the “(s) around the “Extended Properties” values. I was able to populate the DataTable with the contents of the file, … Read more