Hello
I am calling a method that returns a List variable that contains a c# Anonymous Type objects. For example:
List<object> list = new List<object>();
foreach ( Contact c in allContacts ) {
list.Add( new {
ContactID = c.ContactID,
FullName = c.FullName
});
}
return list;
How do I reference this type propert...
Hi all,
it's possible to return, from a method, an anonymous type list?
I build my list of anonymoust type like this
var l = (new[] { new { Name = "thename", Age = 30 } }).ToList();
Thanks
...
I'm still earning my C++ wings; My question is if I have a struct like so:
struct Height
{
int feet;
int inches;
};
And I then have some lines like so:
Height h = {5, 7};
Person p("John Doe", 42, "Blonde", "Blue", h);
I like the initialization of structs via curly braces, but I'd prefer the above be on one line, in an anony...
I wanna create an anonymous type that i can set the property name dynamically. it doesn't have to be an anonymous type. All i want to achieve is set any objects property names dynamically. It can be ExpandoObject etc. But dictionary will not work for me.
What are your suggestions?
thanks a lot
...
Hi,
I often need to augment a object with a property for instance. Until now (tired of it ;) and it's ugly too) I have done it this way:
var someListOfObjects = ...;
var objectsWithMyProperty = from o in someListOfObjects
select new
{
o.Name, /*...
I needed to pass a IGrouping on an anonymously typed index to a function.
List<DataClass> sampleList = new List<DataClass>();
var groups = sampleList.GroupBy(item => new { item.A, item.B, item.C });
I needed to process each of the groups with a function. So I wrote this which works.
static void ProcessGroup<T>(IGrouping<T, DataCl...