Questions tagged [expandoobject]

ExpandoObject is a .NET type whose members can be added and removed at runtime.

From msdn: Represents an object whose members can be dynamically added and removed at run time.

Instances are typically declared with the dynamic keyword:

dynamic sampleObject = new ExpandoObject();

This type is part of System.Dynamic and was introduced with .NET 4.

356 questions
1
vote
1 answer

Convert List to List

I'm currently working on a .NET Framework 4.7.2 application. From a web service response, I need to parse JSON data to a List>>. This datatype is important for the further program flow, I cannot change…
timhorton42
  • 241
  • 5
  • 15
1
vote
0 answers

Get Member Expression of custom property in ExpandoObject

I'm creating a datagrid filter using Expressions in WPF. As my class I use ExpandoObject with both hardcoded and dynamically added properties. When I filter columns with static properties it works, but when I filter columns with dynamic properties i…
1
vote
1 answer

TypeConverter not working with ExpandoObject and DataGrid

I have a Poco class where one Property is an enumeration type. In order to make the enumeration property localizable on the UI layer (WPF) I have created a TypeConverter for the enumeration type which looks up the localized enumeration value. A list…
naitsirhc
  • 133
  • 2
  • 12
1
vote
1 answer

Adding Interface Implementation to ExpandoObject

I am passing information between a SQL database and a PLC using 3rd party OPC libraries. There are essentially two transactions. Information passed from the PLC to the SQL server is statically typed. Very specific data is captured by the PLC and…
Derrick Moeller
  • 4,808
  • 2
  • 22
  • 48
1
vote
1 answer

Dynamically adding dynamic properties at runtime

I want to add Dynamic properties and dynamically to objects. While a similar question is answered here that uses ExpandoObject: Dynamically Add C# Properties at Runtime While the above answer adds properties dynamically, it does not fullfil my…
Ashkan Mobayen Khiabani
  • 33,575
  • 33
  • 102
  • 171
1
vote
1 answer

Select distinct DateTime properties from List> using LINQ

I have a method that returns List>. The objects for the dictionary are created using ExpandoObject and then added to the list with foreach loop. Here is the example of such object: var dataItem = new ExpandoObject() as…
YMM
  • 632
  • 1
  • 10
  • 21
1
vote
1 answer

Dynamically creating an object with dynamic children using data at runtime with ExpandoObject in C#

I've created a dynamic object and set properties and values to it at runtime using ExpandoObject dynamic parentDynamic = new ExpandoObject(); var parentName = "GroupOne"; ((IDictionary)parentDynamic)[parentName] =…
INNVTV
  • 3,155
  • 7
  • 37
  • 71
1
vote
1 answer

ExpandoObject convenience factory?

Does ExpandoObject have any convenience factory methods? Something like, I don't know, dynamic disney = new ExpandoObject("First", "Donald", "Last", "Duck");
William Jockusch
  • 26,513
  • 49
  • 182
  • 323
1
vote
1 answer

C# Dynamic linq order by expando object

I have a situation where I will need to sort dynamically based on a configuration from database table ascending or descending My Database table has column name That I will need to sort and sort order. I have a list of objects, in which each object…
Shashi
  • 1,112
  • 2
  • 17
  • 32
1
vote
1 answer

C# convert list to list and add properties
In c# I wanted to convert List to List and add new properties to object dynamically. List customerList; // has list of customer object List properties; // has { string:propertyname and string:value} I wanted to add some…
Shashi
  • 1,112
  • 2
  • 17
  • 32
1
vote
1 answer

Create Anonymous object from Dictionary

Today I got stuck at one point where I need to convert a Dictionary to an anonymous object. Is there any one who has tried this before. Below is the example what I actually need. var dict = new Dictionary { {…
Himanshu Jain
  • 518
  • 4
  • 20
1
vote
3 answers

Building json from tabular hierarchical data

Let's say I have some data as you see below: { "Menu": { "aaa": "aaa", "bbb": { "ccc": "ccc", "ddd": "ddd" }, "eee": "eee" } } I can save this type of hierarchical data to database…
xkcd
  • 2,538
  • 11
  • 59
  • 96
1
vote
1 answer

How can I convert a List to an XML string

I want to use a List of ExpandoObjects as a datasource for a Telerik Report but it seems that Telerik Reports don't currently support this. They do support having XML as a data source, so I am trying to convert my List of ExpandoObjects to an XML…
patrickjlee
  • 180
  • 2
  • 12
1
vote
0 answers

Json.net deserialization silent error byte[]

The following json is not correctly deserialized by Newtonsoft JSON.NET into byte[]: { ID:123, Name:'test', RowVersion: { $current: null, $current_uid: null, $parent_uid: 1, $type: "System.Byte[], mscorlib", $uid: 2, $value:…
xaviergxf
  • 33
  • 5
1
vote
2 answers

Create dynamic object with unknown property types

I want to create a generic server-side DataTable solution on a ASP.NET MVC application. What I have on each Index view would be a JQuery datatable with a AJAX call to the controller to retrieve the paged data result. The operations performed are as…
Carel
  • 2,063
  • 8
  • 39
  • 65