174 questions
1
vote
1
answer
46
views
dynamic qml object creation does not set properties
I would like to create a dynamic keyboard with 9 keys (nine), and I have created a JavaScript code that should create the buttons and place them in a 9x9 grid:
for (var row = 0; row < 3; row++) {
...
2
votes
2
answers
139
views
C# Dynamic Object call TryInvoke with an unknown array of arguments
I need to invoke a given DynamicObject with a given array of arguments. However, I am struggling on how exactly to do this.
What I would like to do:
using System.Dynamic;
using System.Reflection;
...
1
vote
1
answer
82
views
How do I get the parameter types of a custom C# dynamic method if args are passed as null?
I have been working with creating a custom C# DynamicObject class. I have overloaded TryInvokeMember() and have it working except for some methods that use out parameters. I need to be able to get ...
0
votes
0
answers
77
views
Add Properties ya fields in a C# Dynamically based on length of a list [duplicate]
Let's say that I have a a list of elements of 'n' size. I want to add 'n' properties in a dynamic object .How can I achieve this? We can't just hard code it because length of list is dynamic.
So an ...
0
votes
1
answer
288
views
How to look if system.__comobject is open before I run that object?
I have this dynamic Object to get the system.__comobject from Access:
dynamic app = Marshal.GetActiveObject("Access.Application");
And now I open a form like this:
app.Run("...
-1
votes
1
answer
469
views
How to convert List<model> to string?
I have a list of data and want to convert it into string format like headers and values separated. How can I achieve this in c#?
Expected Result:
dynamic data = {
"values": [
[
...
0
votes
1
answer
189
views
C# Invalid Option Error deserializing nested dynamic object with system.text.json in .Net 6
I'm working with a lot of media files and turning their properties into a dynamic object to process them in VS 2022, C#, .Net 6 Core, and system.text.json. Most of the files have nested parameters. ...
-1
votes
1
answer
173
views
Dynamically assign object properties and values in c#
Help me to create single object with dynamic properties.
For example:
Suppose we are getting the following object from database,
var obj=[
{"name":"John", "age":35},
{&...
0
votes
0
answers
73
views
.NET 6 “core” Create Dynamic Object containing List<MyOtherDynamicListObject> [duplicate]
How do I create a dynamic object that contains another dynamic object in a list?
Let's say I normally have the following non dynamic classes.
Public Class Foo
{
public bool IsSomething ...
0
votes
1
answer
147
views
Ensuring anonymous objects in C# all have certain common properties
I have a problem regarding anonymous objects in C#. The situation is as follows:
I have a C# web app which does NOT use the traditional ASP.NET Razor engine, but instead uses the RazorEngine open ...
0
votes
1
answer
141
views
C# Custom DynamicObject cast to derived object
I have a class DocumentObject that extends DynamicObject to allow dynamic membership attributes.
public class DocumentObject : DynamicObject
{
/// <summary>
/// Inner ...
-1
votes
1
answer
287
views
Create component dynmically in QML (ListElement in ListModel)
I want to create members of an QML-ListModel dynamically. Static creation is no problem and works fine:
ListModel{
id: sList
ListElement{
url: "Res/ex1....
1
vote
1
answer
1k
views
Access object on another form with the form as a variable
I'm writing a program in Delphi which includes creating the same dynamic object on multiple forms (never simultaneously), and then a procedure in another unit writes certain text to it.
How the object ...
0
votes
0
answers
767
views
How to read a value in Dynamic object obtained from JsonConvert.DeserializeObject
I am using httpClient to an API endpoint. There are a couple of possible JSON results I could get back depending on if the call if successful or not.
So I want to use a dynamic or ExpandoObject to ...
1
vote
0
answers
609
views
Json.NET PopulateObject method does not work but DeserializeObject method works for the same type and JSON input
I have a custom type that derives from a DynamicObject and implements the IDictionary<string, object> interface. In order to make this setup work with Json.NET, I use a custom contract resolver (...
0
votes
1
answer
154
views
dynamic object creation and function call [duplicate]
The problem is to call Honda class display method. Which class method will be called depends upon the string variable that will be passed at runtime. Here I have used one parent class of Honda so that ...
2
votes
2
answers
4k
views
How to Dynamically call a method of a class if class name is passed as string
I want to create dynamic object so that I call the respective method of the class. All classes and interface is in different file but under the same folder
Given:
interface Method
{
public void ...
0
votes
1
answer
248
views
C# index to dynamic object variable works in method but not when returned, Error C50021
I have a method that uses MediaInfo.exe to get information from a video file and returns a dynamic object. When the code runs, the information is readable inside the method but when I return the ...
1
vote
1
answer
1k
views
Newtonsoft.Json.JsonSerializationException: 'Unexpected token when deserializing object: Comment with Dynamic Object
I am trying to deserialize the JSON to a object using Newtonsoft.Json. Our input json request has commented line.
{
"paymentMethodToken": "bb3vph6",
"...
0
votes
3
answers
3k
views
Creating an object with a subset of properties and their values from another object
Consider the following class -
public class User
{
[Selected]
public string Name { get; set; }
public string Email { get; set; }
public string Password { get; set; }
[Selected]
...
0
votes
1
answer
3k
views
How create a .net core MVC Model using dynamic object class?
I am looking for a code example to illustrate how to create a Model class in .net core MVC using C#, where the class has dynamic properties. My API receives a http POST request and I am creating one ...
1
vote
1
answer
947
views
How does the PropertyGrid control display two levels of nested dynamic JSON objects?
I have a requirement that several of my colleagues' configuration files should be displayed uniformly with the PropertyGrid control, which I have implemented with reference to the following post:https:...
0
votes
0
answers
514
views
Typecasting dynamic object to class type passed in parameter in C#
I am trying to typecast object inside dynamic object to a type which is passed as a parameter. I searched but couldn't find any specific solution to the issue.
Firstly the structure of the class is as ...
0
votes
1
answer
372
views
How to Creating Dynamic Object from XML with type and Attribute Names in C#?
<root>
<source>
<fields>
<string propertyName="Status" class="System.String" nullable="true" valueInputType="all" displayName=&...
0
votes
0
answers
365
views
C# JObject dynamic object access values issue
So I've got a JSON string that I'm handling with json.net. I'm putting this into a dynamic object and then just accessing the values from that.
dynamic data = JObject.Parse(JsonString);
if(data !=...
0
votes
1
answer
169
views
c# using dynamic tools
in c# form application, when i click the button i create a listBox.
and I add Item to the ListBox from a TextBox
When I click the button, I want the listBox to be created if it does not exist.
...
0
votes
1
answer
1k
views
Attach eventListener on dynamically created input text [duplicate]
i would like to attach eventListener to dynamically created input Text or other objects.
Since the objects are not yet present in the DOM or the objects are not visible, attaching an event to these ...
0
votes
4
answers
1k
views
Cannot convert from custom object to object or dynamic
I have a List which I would like to populate with different types of objects, trying to do it with object\dynamic, but it doesn't, even when casting.
using asp.net core.
See my code:
public ...
1
vote
2
answers
5k
views
C# Instantiate a Class from String name
Having multiple classes doing many things, I am obliged to instantiate one of them, populate some properties and call a method. A sample would be having the below methods e.g.
public class ...
1
vote
0
answers
24
views
I have an Attribute called "public" and i have to access it [duplicate]
Im making a REST Client for a TradeHouse API, it has a giant object with multiple attributes and i want to Convert it into a Class for me to use. For now as i dont want to make my own deserializer im ...
0
votes
2
answers
73
views
WPF c# DynamicObject. how to enforce type checking on the added properties?
I define a DynamicObject.
I have created a list of DynamicObjects with the same structure and link them to a WPF GridView.
I allow editing of some of the properties via the grid.
As the ...
0
votes
2
answers
2k
views
How can set a property using the same name without changing existing value
Using JavaScript, how can I set property of an object that already has property with the same name? For example, what i want to output is:
var obj = {
name: "foo"
};
obj[name] = "baz";
Normal ...
-1
votes
1
answer
1k
views
Construct a dynamic object from another object that has dictionary<string, object> property with varying key-value pairs
I'm trying to collate the properties from an existing object that contains some static properties. The object also contains a Dictionary with key value pairs. These key value pairs should be ...
1
vote
0
answers
192
views
Why is dynamic object in VB.NET calling TryInvokeMember instead of TryGetMember
I am developing a .dll in C# that makes extensive use of DynamicObject.
The .dll in other C# projects works fine, however in VB.NET TryGetMember doesn't seem to be called. Instead TryInvokeMember is ...
3
votes
2
answers
2k
views
How can I make Json.NET serialize and deserialize declared properties of custom dynamic types that also implement IDictionary<string, object>?
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 ...
0
votes
1
answer
73
views
How do I working with objects that can change from one client to another
I have a problem where I data for an object, for example billing file, where the data elements are different from client to client. More specifically the number of fields within the data and of ...
1
vote
0
answers
508
views
Create property dynamically in viewmodel MVVM light and UWP
I would like to create viewmodel properties in runtime.
I'm not so familiar with MVVM in UWP. Rather windows forms. In the past I created custom class object with reflection and I had possibility to ...
0
votes
2
answers
205
views
Providing a DynamicObject properties
I need a way to provide a Dynamic get members and set for a given class.
I want to be able to write code like this:
ns1.Resource.Field1 = "Hello";
string myField = ns1.Resource.Field1;
where ns1 ...
0
votes
0
answers
109
views
List ExpandoObject properties at run-time by pressing "dot" in Visual Studio
In our .NET Core project we have service references for SOAP APIs. But since we have a lot of them, we implemented a generic method which invokes the method in SoapClient so that we can just call:
...
1
vote
1
answer
995
views
JsonConvert.DeserializeObject w/ DynamicObject and TypeCreationConverter
I have a class EntityBase that derives from DynamicObject without an empty default constructor.
// this is not the actual type but a mock to test the behavior with
public class EntityBase : ...
0
votes
1
answer
1k
views
Let DynamicObect's TryGetMember and TrySetMember return a class in C#
I have a class inheriting from DynamicObject
In this class I have a TryGetMember that I try to evaluate to a static class.
How can TryGetMember overriden from DynamicObject result in a static class?
...
1
vote
1
answer
2k
views
Create a dynamic object that implements my custom interface
I am creating some custom API. What I need is pass some object to the api that have "static" required propreties and dynamic optional properties.
I have created a dynamic custom object like this:
...
5
votes
0
answers
99
views
Does ExpandoObject in c# has instance accessor like this?
consider I have this simple c# code:
dynamic obj = new ExpandoObject();
obj.FirstName = "John";
obj.LastName = "Doe";
I want to add method which will return full name, John Doe in this case.
I know ...
2
votes
0
answers
230
views
C# Check the values of dynamic object properites while debugging
I encountered a WCF service which returns a dynamic object. But in debug mode the properties of dynamic objects were not allowed to visible. How to see dynamic object property values while debugging. ...
1
vote
1
answer
996
views
C# DataBinding / Update DynamicObject property from another thread
Previously I was working on an implementation of DynamicObject data binding (see Dynamic object two way data binding), and the solution works great. Since then I have run into the need to be able to ...
0
votes
1
answer
2k
views
binding observable collection of custom objects containing array
i'm learning wpf and binding and all and i have a gridview and a custom object
i'm trying to bind a list of custom objects to the grid my custom object is designed like this
Public class myObject ...
4
votes
1
answer
289
views
Serialize instance of a class deriving from DynamicObject class
I have a class that derives from DynamicObject class. On calling JsonConvert.SertializeObject, none of the dynamic properties are serialized.
Class is defined as,
public class Component : ...
0
votes
1
answer
1k
views
Dynamic class creation using Dictionary<string,object>
I have a class called CoverageBase with properties say A, B, C. And now based on some checks i need to append n number of properties say D and E properties in to this CoverageBase class along with my ...
0
votes
1
answer
1k
views
WPF C# - Saving a Canvas with Dynamic Devices with Code Behind properties (variables)
We've searched all over stack overflow and similar sites for something that will work for our app, but everything gets us only halfway there.
We have an application that allows the user to drag and ...
0
votes
1
answer
53
views
How to expand a dynamic object wthout disrupting its existing members?
I have a dynamic object called Manifest and have members added in it like
public dynamic manifest={
Type=30,
components ={ .. something}
}
I want to expand this dynamic ...