I'm pretty new to LINQ and I wonder if it's possible to do the following thins:
I have an array of objects with several properties. I want to create a new array with the values of one of those properties, so if I have this class:
public class TestClass
{
public string A {get;set;}
public string B {get;set;}
public string C {get;set;}
}
this is what I want to do:
public class ToDo
{
private TestClass[] _array;
private string[] _cProperties;
_cProperties = queryToExtractTheValuesOfCfromTheArray_array;
}
Thanks in advance!
sure:
string[] _cProperties = _array.Select(x => x.C).ToArray();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With