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
votes
1 answer

Understanding dynamic POST body parameter

I have a dotnet core Web API which accepts a body message containing JSON. I have tried writing this in various forms, eg: [HttpPost] public async Task Create([FromBody] dynamic content) Is difficult to retrieve the properties and…
Matt W
  • 11,753
  • 25
  • 118
  • 215
-1
votes
1 answer

ExpandoObject in C++/CLI

I defined the function in C# DLL as follows, public class Class1 { public static dynamic CS_Func() { dynamic obj = new ExpandoObject(); obj.num = 99; return obj; } } In another C# EXE, it could be called like…
lixiangc
  • 11
  • 2
-1
votes
1 answer

Add some sort of interface to a Dynamic.ExpandoObject object

I am using a library that return a IList (from a jsonArray), dynamic means not having any intellisense while using such object, I would like to be able to simply define what the dynamic object contains.
reonZ
  • 135
  • 2
  • 10
-1
votes
1 answer

How to avoid ExpandoObject flattening?

Model looks like this: public class Foo { public long Id { get; set; } public ExpandoObject Attributes { get; set; } } What I get as a result from Web API call: [ { Id: 1, Attribute1: "XYZ", Attributes: "ABC" …
mankers
  • 742
  • 10
  • 19
-1
votes
1 answer

JSON to ExpandoObject convertion in C#

{ "Jhone":[ { "Key":"Employeename", "Value":"Jhone" }, { "Key":"Address", "Value":[ { "Key":"City", "Value":"Newyork" }, { "Key":"Country", …
Veeramani
  • 19
  • 1
  • 7
-1
votes
2 answers

c# initialize expandoobject from list

I want to initialize an expandoObject from List. internal class CarKeyValue { public CarKey CarKey { get; set; } public string Value1 { get; set; } public string Value2 { get; set; } } public enum CarKey { Brand = 1, Model = 2, …
is_oz
  • 813
  • 1
  • 8
  • 27
-1
votes
3 answers

Using System.Dynamic not recognized

I am using Visual Studio 2010 .NET 4.X and I'm trying to use the ExpandoObject class, but I'm getting a not recognized error on the using System.Dynamic statement. I made sure to add a reference to System.Core, but that didn't resolve the issue. Is…
O.Deitch
  • 3
  • 2
-1
votes
1 answer

How can I use a List as with DataGridView.DataSource?

I'm trying to bind a List to a DataGridView DataSource property. While there are no errors when compiling there are no columns being displayed either. If I pre-create the column I get the rows to display, but there's no data in…
JohnUbuntu
  • 699
  • 6
  • 19
-2
votes
1 answer

Expando Object and IEnumerable returns cannot convert implicitly void to object

This code is throwing and error 'cannot implicitly convert type void to object' dynamic disruption1 = new ExpandoObject(); disruption1.locationsAffected = new string[] { "london", "panama" }; IEnumerable disruptionList = new…
Yatiac
  • 1,820
  • 3
  • 15
  • 25
-3
votes
1 answer

Converting 1000s ExpandoOject / dynamic to static type takes forever

I am trying to convert a list of 1000s dynamic (that I get from CsvHelper reading csv file) into static type but its taking forever. Here's code: dynamic object MyObj { id =1, prop1=1,prop2=2,prop3=3... } result …
Bhavesh
  • 819
  • 1
  • 17
  • 31
-3
votes
1 answer

Order,group and sum List of array in ExpandoObject c#

I am trying to sum the "col3" values by ordering and grouping the "col1" and "col2" using C# Linq. List list = new List(); dynamic expando = new ExpandoObject(); dynamic expando1 = new ExpandoObject(); var p = expando…
1 2 3
23
24