Top "Anonymous-types" questions

Anonymous types are data types which dynamically add a set of properties into a single object without having to first explicitly define a type

Non-read only alternative to anonymous types

In C#, an anonymous type can be as follows: method doStuff(){ var myVar = new { a = false, b = true } if (myVar.…

c# data-structures struct anonymous-types
Get value from anonymous type

I have a method as following: public void MyMethod(object obj){ // implement } And I call it like this: MyMethod(new { …

c# asp.net-mvc asp.net-mvc-3 c#-4.0 anonymous-types
Can I serialize Anonymous Types as xml?

I understood that anonymous types are marked private by the compiler and the properties are read-only. Is there a way …

.net xml serialization anonymous-types
Working with C# Anonymous Types

I am calling a method that returns a List variable that contains a c# Anonymous Type objects. For example: List&…

c# dynamic .net-4.0 anonymous-types
How to create an anonymous object with property names determined dynamically?

Given an array of values, I would like to create an anonymous object with properties based on these values. The …

c# anonymous-types dapper
How to use Expression to build an Anonymous Type?

In C# 3.0 you can use Expression to create a class with the following syntax: var exp = Expression.New(typeof(MyClass)); …

c# linq expression-trees anonymous-types
how to map an anonymous object to a class by AutoMapper?

I have an entity: public class Tag { public int Id { get; set; } public string Word { get; set; } // other properties... // and …

c# mapping automapper anonymous-types
C# Anonymous types cannot be assigned to -- it is read only

What is wrong with this code-snippet? class Program { static void Main(string[] args) { var obj = new { Name = "A", Price = 3.003 }; obj.…

c# c#-3.0 anonymous-types
Naming an anonymous function

Is it possible to somehow set a name for anonymous functions? There is no need to add function names to …

javascript debugging anonymous-types
How to access count property of a dynamic type in C# 4.0?

I have the follow method that returns a dynamic object representing an IEnumerable<'a> ('a=anonymous type) : public …

c# reflection dynamic c#-4.0 anonymous-types