Reputation: 8934
Hey, I'm stuck in a converting a simple Linq statement from query syntax to fluent syntax in C#. I think that is possible, but I need a hint.
from property in target.GetType().GetProperties()
select new
{
Name = property.Name,
Value = property.GetValue(target, null)
};
to..
var props = target.GetType().GetProperties().Select(p=>p.Name.... )
What I need change after Select
?
Upvotes: 1
Views: 1698
Reputation: 18125
var props = target.GetType()
.GetProperties()
.Select(p => new {
Name = p.Name,
Value = p.GetValue(target, null)
});
?
Upvotes: 1
Reputation: 14409
var props = target
.GetType()
.GetProperties()
.Select(p => new {
Name = p.Name,
Value = p.GetValue(target, null)
});
Upvotes: 11