LastIndexOf bug? [closed]
As per the docs: public int LastIndexOf (char value, int startIndex, int count) “The search proceeds from startIndex toward the beginning of this instance.” The first comma before index 223 occurs at index 221.
As per the docs: public int LastIndexOf (char value, int startIndex, int count) “The search proceeds from startIndex toward the beginning of this instance.” The first comma before index 223 occurs at index 221.
Rather try something like MessageBox.Show(DateTime.Today.DayOfWeek.ToString()); DateTime.Today Property Gets the current date. Your problem is that DateTime date = new DateTime(DateTime.Now.Date.Day); evaluates to {01/Jan/0001 12:00:00 AM} The constructor you used was DateTime Constructor (Int64) Initializes a new instance of the DateTime structure to a specified number of ticks.
Your desired result seems wrong to me… You only want active records, ok check The order they were inserted… 3 > 4 > 5 > 6 > 7 not 7 > 5 > 3 > 4 > 6 In the top table Person ID was added again giving it an ExpenseID of 7 which is … Read more
You can write your own extension method that works like the built-in LINQ methods: public static class Extensions { public static IEnumerable<T> DistinctWhere<T>(this IEnumerable<T> input, Func<T,bool> predicate) { HashSet<T> hashset = new HashSet<T>(); foreach(T item in input) { if(!predicate(item)) { yield return item; continue; } if(!hashset.Contains(item)) { hashset.Add(item); yield return item; } } } } … Read more
string[] s = args[0].Split(new char[] { ‘ ‘, ‘,’ }, StringSplitOptions.RemoveEmptyEntries);
Put the TextBlock in the HeaderTemplate of the column: <DataGridTemplateColumn x:Name=”col”> <DataGridTemplateColumn.HeaderTemplate> <DataTemplate> <TextBlock Text=”Current” ToolTip=”Price” ToolTipService.InitialShowDelay=”0″ ToolTipService.Placement=”Top” ToolTipService.ShowDuration=”999999″ RenderOptions.BitmapScalingMode=”NearestNeighbor”/> </DataTemplate> </DataGridTemplateColumn.HeaderTemplate> </DataGridTemplateColumn> …and find it in using the VisualTreeHelper: private void Button_Click(object sender, RoutedEventArgs e) { var columns = FindVisualChildren<System.Windows.Controls.Primitives.DataGridColumnHeader>(dataGrid)? .ToArray(); if (columns != null) { int columnIndex = 1; if (columns.Length > columnIndex) … Read more
You could do that with a simple Regex, But you should really read some MSDN articles before you try to “use them” // Match a Regex and Do Stuff public void showMatch(string input, string expr) { MatchCollection mc = Regex.Matches(input, expr); int num = 0; foreach (Match m in mc) { string tm = m.ToString(); … Read more
You need to tell the SMTP client that you will not be using your windows credentials to access the SMTP, so add smtpClient.UseDefaultCredentials = false; above this line of code smtpClient.Credentials = new NetworkCredential(“[email protected]”, “password”); Also, gmail doesn’t allow impersonation, so mailMessage.From = new MailAddress(“[email protected]”); will have no effect – the emails will still appear … Read more
I don’t know about notepad++, but you can use vim
You can convert a number to hex like this: 0x8080.ToString(“x6”) The 6 is the number of decimal places. See the documentation for more detail.