private void DgRefTable_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
{
DataGrid dg = (DataGrid)sender;
object src = dg.ItemsSource;
Type type = src.GetType().BaseType.GetGenericArguments()[0];
PropertyInfo property = type.GetProperty(e.Column.Header.ToString(), BindingFlags.Public | BindingFlags.Instance);
if (property.IsDefined(typeof(RTFieldAttribute), true))
{
e.Column.Header = ((RTFieldAttribute)property.GetCustomAttributes(typeof(RTFieldAttribute), true)[0]).HeaderText;
}
}
string input = "Раз два три четыре пять, я иду искать";
string[] words = input.Split(new char[] { ' ', ',', '.', '-', '!', '?' }, StringSplitOptions.RemoveEmptyEntries);
foreach(var word in words) { Console.WriteLine($"{word}: длина {word.Length}"); }
using System;
using System.Text.RegularExpressions;
namespace ConsoleApp2
{
class Program
{
static void Main(string[] args)
{
string input = "blablabla print('Test 1'); blabla print('Test 2')";
string pattern = @"print\(\'([^\']*)\'\)";
foreach (Match m in Regex.Matches(input, pattern))
{
Console.WriteLine(m.Groups[1].Value);
} // foreach
Console.ReadLine();
} // Main
} // class Program
} // namespace
Test 1
Test 2