This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT name FROM sysobjects WHERE id IN ( SELECT id FROM syscolumns WHERE name = 'email' ) | |
SELECT name FROM sysobjects WHERE id IN ( SELECT id FROM syscolumns WHERE name like '%PART_OF_NAME%' ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var list = new List<string>() {"Asia", "Africa", "North America", "South America", "Antartica", "Europe", "Australia"}; | |
// Get all the items from the list that start with | |
// an 'A' and have 'r' as the 3rd character | |
var filteredList = list.Where(item => item.StartsWith("A")).Where(item => item[2] == 'u').ToList(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Take the first 3 items from list 'list' and create a new list with them | |
var shortList = list.Take(3).ToList(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var listWithoutDuplicates = list.Distinct().ToList(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
list.ForEach(Console.WriteLine); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var str = "H1e2l3l4l5o6"; | |
// Count all digits in a string | |
var numOfDigits = str.Count(char.IsDigit); | |
// Count all lowercase characters in a string | |
var numOfLowerCase = str.Count(char.IsLower); | |
// Count all uppercase characters within a string | |
var numOfUpperCase = str.Count(char.IsUpper); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var list = new List<string>() { "Asia", "Africa", "North America", "South America", "Antartica", "Europe", "Australia" }; | |
var list2 = new List<string> {"Africa", "South America", "Antartica", "Foo"}; | |
// Get all items in the list that do NOT have matching items on a different list | |
var list3 = list.Except(list2).ToList(); | |
// Get all items in the list that have matching items on a different list | |
list3 = list.Intersect(list2).ToList(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string str = "45,43,122,75,34"; | |
int[] values = str.Split(',').Select(o => Convert.ToInt32(o)).ToArray(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return categories.SelectMany(i => this.GetAllChildCategoriesIds(i.Id)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Console.WriteLine(Console.ReadLine().Split(' ').Select(t => int.Parse(t)).ToList().Max()); |
OlderNewer