Thread.Sleep()
await Task.Delay()
<DataGrid x:Name="DataGrid" ItemsSource="{Binding CustomerList}" AutoGenerateColumns="True" />
string str = "#one# two *three* *four* #five#"; var splitted = str.Split('#', '*'); var trimmed = splitted.Where((n, i) => (i % 2) != 0).Select(n => n); foreach (var match in trimmed) Console.WriteLine(match.ToString());
Max
SequenceIntegerColumn
NuGet
MoreLinq
MaxBy
foreach
ApplicationDbContext
IdentityDbContext<IdentityUser>
var dt3 = DateTime.ParseExact( "6/16/2022 11:40 PM", "M/dd/yyyy hh:mm tt", CultureInfo.InvariantCulture); Console.WriteLine(dt3.ToString());
Where
&&
Contains
==
Data Type
bool Verify()
bool IsVerified
data.Where(p=>p.IsVerified)
Random random = new Random(); //range 600 to 700 inclusive int[] choices = Enumerable.Range(600, 101).ToArray(); // Fisher–Yates shuffle method int i = choices.Length - 1; while (i > 0) { //k is chosen from a decreasing number of elements int k = random.Next(i + 1);//range is 0-i inclusive var temp = choices[i]; choices[i] = choices[k]; choices[k] = temp; i--; } int N = 6;//provided by user int[] X = new int[N]; Array.Copy(choices, X, X.Length);
ClearEntries
static void ClearEntries(List<string[]> blogPost) { blogPost.Clear(); }
//use named values List<(string value, int index)> uniquelist = myList.Distinct() //Simply declare the tuple rather than instantiate it .Select(x => ( x, myList.IndexOf(x))) .ToList(); List<int> indOfDup = Enumerable.Range(0, myList.Count) //reference the index by name rather than 'Item2' .Where(x => !uniquelist.Any(y => y.index == x)) .ToList();
Bgw_DoWork
<TextBlock x:name="txtBlock_intestazione" Style="{StaticResource TbIntestazione}" Text="{Binding Path=Denominazione, UpdateSourceTrigger=PropertyChanged}"/>
string tester = "1 cup of hot coffee costs 8.00, whereas cold coffee costs 45.00."; string[] words = tester.Split(' '); List<string> reversedWords = new List<string>(); foreach(var word in words) { string trimmed = word.Trim(',', '.', ';'); string s = double.TryParse(trimmed, out _) ? word : ReverseString(word); reversedWords.Add(s); } var reversed = string.Join(" ", reversedWords);
public static int Play() { int initialChoice = random.Next(3);//make a choice int winningDoor = random.Next(3);//the car is here return initialChoice == winningDoor ? 0 : 1; }
char[] chars = word3.Select(c => char.ToUpper(c)).ToArray(); return new string(chars);
while
sr
sr2
i < t+1;