Answers for "how to use contains in collection of objects for a property field"

C#
0

check property type of collection c#

var obj = new PropClassDemo();
foreach (PropertyInfo prop in obj.GetType().GetProperties())
{
	if(prop.PropertyType != typeof(string) && typeof(IEnumerable).IsAssignableFrom(prop.PropertyType))
	{
		Console.Writeline("This prop's type is Ienumerable");
	}
}

//Note: string is an ienumerable too
Posted by: Guest on July-08-2020
0

find the property is matching

let wantedProperty = (arrayOfObjects.find(obj => obj.id === wantedObject.id) || {}).title || 'None Found';
Posted by: Guest on March-25-2020

Code answers related to "how to use contains in collection of objects for a property field"

C# Answers by Framework

Browse Popular Code Answers by Language