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

User profile service using dynamic

In a system I'm working on there is a core User table. There are also roles designating various user types and application level access. To keep the user table succinct, there is going to be a number of tables (or possibly just 1 table) holding the…
Chris W
  • 1,792
  • 15
  • 32
0
votes
1 answer

JavaScriptConverter, ExpandoObject and dynamic types

I have a little test class like so : public class Command { public dynamic MyData { get; set; } } As the dynamic MyData I want to use ExpandoObject, so I can do: Command cmd = new Command(); cmd.MyData = new…
Daniel Gruszczyk
  • 5,379
  • 8
  • 47
  • 86
0
votes
1 answer

ServiceStack post request with dynamic or DynamicTableEntity object

I am building a ServiceStack service as a Windows Azure Cloud web role. I am trying to POST data/DTO, having properties of type dynamic/ExpandoObject or DynamicTableEntity class, to my service method so that i cloud be able write a generic method to…
Haider
  • 1,488
  • 2
  • 15
  • 29
0
votes
1 answer

How to extend a method at runtime?

Here is the class: class Foo { private void Boo() { // Body... } // Other members... } What I need is: Create a Foo2 class at runtime which has a copy of all Foo class members. In Foo2 class replace Boo method by Boo2…
Ryszard Dżegan
  • 24,366
  • 6
  • 38
  • 56
0
votes
0 answers

System.Dynamic.ExpandoObject' does not contain a definition for 'PropertyName' when the property exsists

I am using some ExpandoObject dynamics in a MVC application of mine and I am running into the above error. It only is seeming to happen with one or two properties but it is consistent. I will get the run-time error stating that no such property…
Bozarth
  • 166
  • 1
  • 8
0
votes
0 answers

Using ExpandoObject with anonymous type

I've been using the ExpandoObject() workaround for anonymous types that has been discussed on this site. I am running into a problem though as my view won't compile. I have used the following extension: public static ExpandoObject ToExpando(this…
serlingpa
  • 12,024
  • 24
  • 80
  • 130
0
votes
1 answer

How can I overload method with ExpandoObject?

I have the following expando object dynamic person = new ExpandoObject(); person.FirstName = " FirstName "; person.SecondName = " FirstName "; person.FullName = person.FirstName + person.SecondName; person.BirthDate…
Amr Badawy
  • 7,453
  • 12
  • 49
  • 84
0
votes
1 answer

ExpandoObject working differently in vb.net then in c#

after converting some code fron here https://github.com/facebook-csharp-sdk/facebook-winforms-sample the isnt acseptig code like parameters.client_id here is the section im haveing problems with Private Function GenerateLoginUrl(ByVal appId As…
Ioan Loosley
  • 119
  • 1
  • 1
  • 11
0
votes
1 answer

ExpandoObject causes rule violation CA1502:Avoid excessive complexity

I have code that performs a mail merge type operation, and I am using dynamic/ExpandoObject to assemble the properties. I am doing this instead of building an anonymous class because different methods along the way add properties before the mail…
CodeGrue
  • 5,865
  • 6
  • 44
  • 62
0
votes
1 answer

Why do I have to manually create ExpandoObject to properly use the dynamic keyword?

I was looking at the question Use 'dynamic' throw a RuntimeBinderException. I face a similar problem: Basically, I want to create a "HTML helper" in ASP.NET MVC that uses dynamic arguments, akin to the htmlArguments parameter for many of the…
Cornelius
  • 830
  • 11
  • 31
0
votes
2 answers

MethodInfo from ExpandoObject

I know that it was asked for Reflection on ExpandoObjects here before. My question is a little different. I have static and dynamic functions which should be executed from some function similar to object ExecuteFunction(string name, params object[]…
Dominik G
  • 1,459
  • 3
  • 17
  • 37
0
votes
1 answer

MVC 3 WebGrid with a dynamic source

I have a dynamic list of data with a dynamic number of columns being created by a PIVOT function. Everything more or less works, but I wanted to apply some custom formatting to some of the columns. I figured out how to get a list of the columns by…
ewahner
  • 1,149
  • 2
  • 11
  • 23
0
votes
3 answers

'System.Dynamic.ExpandoObject' does not contain a property with the name 'Name'

Here is what I have: var listAddresses = GetAddresses().ToList(); return Json(new JsonResult { Data = new SelectList(listAddresses, "Name", "Id") }, JsonRequestBehavior.AllowGet); But I get the error 'System.Dynamic.ExpandoObject' does not contain…
petko_stankoski
  • 10,459
  • 41
  • 127
  • 231
-1
votes
2 answers

Can we Create automatic Get and Set Property at Run time?

I want to create public object Value { get; set; } public Type Type { get; set; } public string Name { get; set; } public string "user has to give propertyname" {get;set;} at run time as per user requirement . Is it possible to do this in…
-1
votes
1 answer

ExpandoObject changing the value

I have an ExpandoObject. inside the object there are bool values. i need to change that to a string. here is an example code. In the dict the value of coke needs to be changed to string "true" and Coke "false". I cannot search for the key like coke…
Mr Sumo
  • 51
  • 5
1 2 3
23
24