Questions tagged [dynamicobject]

A Microsoft .NET Framework (version 4+) base class for specifying dynamic behavior at run time.

The DynamicObject class enables you to define which operations can be performed on dynamic objects and how to perform those operations. The DynamicObject class enables you to override operations like getting or setting a member, calling a method, or performing any binary, unary, or type conversion operation.

Inheritance Hierarchy

System.Object   
  System.Dynamic.DynamicObject

Reference: https://msdn.microsoft.com/en-us/library/system.dynamic.dynamicobject%28v=vs.110%29.aspx

171 questions
3
votes
2 answers

How can I make Json.NET serialize and deserialize declared properties of custom dynamic types that also implement IDictionary?

I have a custom type derived from the DynamicObject type. This type has fixed properties declared in the type. So it allows the user to provide some required properties in addition to any dynamic properties they want. When I use the…
B Singh
  • 113
  • 1
  • 9
3
votes
1 answer

C# Converting a DynamicObject to arbitrary type

I'm writing a Javascript <-> C# bridge and ran into the following problem: There's a class JSObject: public class JSObject : DynamicObject { public JSEngineAPI wrappedObject { get; set; } public JSObject(JSEngineAPI WrappedObject); …
nitrogenycs
  • 962
  • 9
  • 13
3
votes
1 answer

DynamicObject - invoking method based on argument value

I'd like to be able to store a dictionary of Actions and being able to invoke those based on key for the dictionary. If key is not found, then no action is getting invoked. I had an idea of performing invocation using an object that extends…
Sean Feldman
  • 23,443
  • 7
  • 55
  • 80
3
votes
1 answer

How do I search a dynamic object IEnumerable using a dynamically built lambda expression?

Previously, I had great help on my previous question, thank you vyrp , How do I create and populate a dynamic object using a dynamically built lambda expression I'm now looking to search the dynamic object, and as before, I don't know the objects…
Mark
  • 69
  • 10
3
votes
1 answer

Inheriting from class that inherits from DynamicObject

I'm experimenting with C# 4.0's dynamic object model. I've created an abstract class named "Block" that inherits from DynamicObject. It overrides TryGetMember and TrySetMember. Furthermore I've created a usable class named "Brush" that inherits…
Hendrik Wiese
  • 2,010
  • 3
  • 22
  • 49
3
votes
2 answers

Value of result when implementing void methods via DynamicObject

I'm looking at the examples for overriding TryInvokeMember on DynamicObject to implement dynamic method binding. The signature is as follows public virtual bool TryInvokeMember( InvokeMemberBinder binder, Object[] args, out Object…
Brian Rasmussen
  • 114,645
  • 34
  • 221
  • 317
3
votes
2 answers

read dynamic json files in java and merge them

I am struggling with json-parsing in java. Is there a possibility to generate a representation of a random, not standardised json file in java? I tried to use gson but I didn't really understood if and how that might be possible. So the jsonFile…
malle
  • 334
  • 4
  • 17
3
votes
0 answers

'System.Net.Http.HttpRequestMessage' has no applicable method named

I'm trying to create a response which sends the HttpStatusCode along with a dynamic object like this: var t = _rep.GetOrders(params, sft); ........... return Request.CreateResponse(HttpStatusCode.OK, Enumerable.Select(t, (Func)(x…
Yustme
  • 6,125
  • 22
  • 75
  • 104
3
votes
1 answer

Casting WebMatrix DynamicRecord or retrieving the underlying IDictionary

this might be an easy one but I am really not getting it. As far as I understand: The most dynamic types ins C# rely on IDictionary I did a spike with WebMatrix.Data and I would like to cast my result to IDictionary but…
silverfighter
  • 6,762
  • 10
  • 46
  • 73
3
votes
1 answer

How to get ServiceStack to serialize a dynamic (ExpandoObject) property on request

Are there any extra configurations that are necessary to get ServiceStack to deserialize a JSON request into an appropriate dynamic object? I have compiled the Net40 version of the ServiceStack.Text library that includes the DynamicJson class and…
3
votes
0 answers

Patterns / Problems that use dynamic types, dynamic objects and expando objects in C#

I have recently become aware of the dynamic keyword after doing some digging into Dynamic Objects and Expando Objects in C# I can appreciate that it is quite cool however apart from a ViewBag in ASP.NET MVC I am struggling to find applications for…
AJM
  • 32,054
  • 48
  • 155
  • 243
3
votes
2 answers

Bind WPF Extended Toolkit PropertyGrid to a dictionary or other dynamic source?

I have an XML file with several child elements. Each child element contains a series of elements, but the XML schema is undocumented, so I cannot possibly account for every possible element name. My goal is to provide an editor view for each child…
Chris
  • 27,596
  • 25
  • 124
  • 225
2
votes
1 answer

Using DynamicObject to simulate DependencyProperties

I'm looking to create something akin to one of the features of VS or Blend whereby when one selects multiple objects, the property grid shows the value for any property that is shared by all objects and shows nothing for properties that differ…
Richard SP.
  • 497
  • 6
  • 15
2
votes
1 answer

Is there any Ready-to-use DynamicObject in C#?

I know viewbag is one of the ready-to-use DynamicObject, but if you are not in a view or controller, is there any other Ready-to-use DynamicObject except to write your own? (btw, I found a sample of a great implement…
Eric Yin
  • 8,737
  • 19
  • 77
  • 118
2
votes
1 answer

Proxying a collection interfaces dynamically

I have occasionally had cause to write collection class adapters, i.e. create an adapter for a class that implements IList proxying its methods, whist adding some extra functionality. The IList interface has numerous methods / properties, I was…
ColinE
  • 68,894
  • 15
  • 164
  • 232
1 2
3
11 12