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

'ExpandoObject' does not contain a definition for 'PropertyChanged'

I am attempting to use ImpromptuInterface to solve the issue I am having here. Adding Interface Implementation to ExpandoObject. I am now able to access various properties of my interface in my base class but I can no longer subscribe to…
Derrick Moeller
  • 4,808
  • 2
  • 22
  • 48
2
votes
1 answer

FastMember and ExpandoObject error

I'm not sure if its supported but I'm trying to get fastmember to give me type information for a dynamic ExpandoObject (using the code below) and I get the error: System.NotSupportedException: Specified method is not supported. at…
gmn
  • 4,199
  • 4
  • 24
  • 46
2
votes
0 answers

VS2015 can't find Newtonsoft.Json converters?

It feels like this should be so simple, but I'm very stuck on it. In VisualStudio 2015 with .Net4.5.2, I'm trying to deserialize JSON into a dynamic object in C#. I've added a NuGet package for Newtonsoft.Json v9.0.0.0 and I've added the proper…
Jarvis
  • 681
  • 8
  • 33
2
votes
0 answers

C# - get the PropertyDescriptorCollection of a dynamic object

I want to populate a PropertyDescriptorCollection from an ExpandoObject like this : PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(obj.GetType()); int propsCount = properties.Count; but I always get 0 in propsCount even if…
yosboss
  • 21
  • 2
2
votes
0 answers

How to build dynamic LINQ for expando Object list?

I read almost topic about dynamic LINQ as: + C# Dynamic linq order by expando object + build linq queries dynamically ... However, my list contains expando Object. So i can't apply dynamic linq as: query =…
mrfour.it
  • 31
  • 3
2
votes
1 answer

Dynamically adding properties to an Object from an existing static object in C#

In my ASP .Net Web API Application while making the DB calls, some properties are needed to be added to the Model Class which already have some existing properties. I understand I can use ExpandoObject in this case and add properties at run time,…
StrugglingCoder
  • 4,781
  • 16
  • 69
  • 103
2
votes
2 answers

create objects from properties in string

object with additional properties from json-like notation string should created. Method will called from Razor view to pass colmodel to jqgrid as json object like @Html.Raw( Json.Encode( Model.GetColModel())) Method should have signature…
Andrus
  • 26,339
  • 60
  • 204
  • 378
2
votes
1 answer

Using ExpandoObject when property names are dynamic, is this possible?

I need to create an object that has properties that are named dynamically like: john max asdf Is this possible?
cool breeze
  • 4,461
  • 5
  • 38
  • 67
2
votes
1 answer

When/Why should I use late-binding? (DynamicObject and ExpandoObject)

While DynamicObjects and ExpandoObjects (Differences between ExpandoObject, DynamicObject and dynamic) sound quite useful at first, i did never actually use them. It feels like late-binding is quite unsafe/unstable since it might throw errors at…
H W
  • 2,556
  • 3
  • 21
  • 45
2
votes
1 answer

Error using ExpandoObject in ASP.NET MVC

I have an ASP.NET MVC app. I am using the ExpandoObject in my app. Currently, I have the following block in my .cshtml file: foreach (System.Dynamic.ExpandoObject expo in ViewBag.ExpandoObjects) {
@filter.GetType().FullName
} This…
xam developer
  • 1,923
  • 5
  • 27
  • 39
2
votes
1 answer

dynamic/ExpandoObject method throws 'No default member found for type 'Action'

I can't get a dynamic method on an ExpandoObject to be directly callable in VB.NET. In C# the following works: dynamic obj = new System.Dynamic.ExpandoObject(); var called = false; obj.ForceRefresh = new Action(() => called =…
NDJ
  • 5,189
  • 1
  • 18
  • 27
2
votes
2 answers

how to count property of an ExpandoObject

I am trying to count the dynamic properties of an ExpandoObject. I have tried int count = values.ICollection>.Count(); but it generates error. Any help? UPDATE: how can i read a property at specific index?
s.k.paul
  • 7,099
  • 28
  • 93
  • 168
2
votes
1 answer

How do I pass an ExpandoObject from C# into IronRuby?

Executing the below code gives me the following exception on the last line: InvalidOperationException: "unbound variable: value" var rubyRuntime = Ruby.CreateRuntime(); rubyRuntime.UseFile("HandleMoveRequested.rb"); var engine =…
Troy
  • 1,640
  • 10
  • 16
2
votes
1 answer

adding new properties in expando object in foreach loop

I have to add new properties in expando object in foreach loop but I am not able to see a way to do it. Here is the example: var allProperties = new List { "Name", "Email", "Roles"…
Azhar Kiani
  • 323
  • 4
  • 11
2
votes
1 answer

Why anonymous types aren't dynamic as the ExpandoObject?

With dynamic we pretty much have a dynamic pointer, but not exactly a dynamic object. The true dynamic object in C# is the ExpandoObject, but that is a really unknown class for most of people. The expando allows creating and removing members at…
talles
  • 14,356
  • 8
  • 45
  • 58