Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Linq-Where-Condition on a collection of anonymous types
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { var objectsReturnedFromRaycast = new[] { new { name = "unit01", tag = "player_unit", layer = "selectable" }, new { name = "unit02", tag = "player_unit", layer = "selectable" }, new { name = "building", tag = "player_building", layer = "selectable" } }; var playerUnits = objectsReturnedFromRaycast.Where(o => o.tag == "player_unit"); var playerBuildings = objectsReturnedFromRaycast.Where(o => o.tag == "player_building"); foreach(var unit in playerUnits) { Console.WriteLine(unit.name); } foreach(var building in playerBuildings) { Console.WriteLine(building.name); } } } }
run
|
edit
|
history
|
help
0
asxsadxsdf
Testing 003
Fibonacci recursion
How to find second largest integer in an array using only one loop?
Список Лекарств
ATM
FizzBuzz C#
перегружаемый оператор
Exemplu OOP inventar
TempConverter