All Questions
88
questions
-1
votes
1
answer
139
views
How do you access the properties of an object when that object is the value of a key/value pair in a dictionary in c#? [duplicate]
C#:
I have this dictionary:
Dictionary<string, Object> ourAnimals = new ();
Each key is a string, such as "d1".
Each value is an object. Here is the class definition for those objects:
...
1
vote
1
answer
407
views
C# Dictionary to Array of objects
I'm trying to link drives to their partitions; the code is working and the data is being retrieved as a single object.
"DeviceID_0": "\\.\PPHYSICALDRIVE0",
"SerialNumber_0&...
-1
votes
2
answers
2k
views
Passing a C# Dictionary as a function parameter to allocate its memory does not work
I have below code
using System;
using System.Collections.Generic;
class Program {
static void add(Dictionary<string,string> hello){
hello = new Dictionary<string,string>();
...
1
vote
0
answers
27
views
C# deep copy a generic Dictionary [duplicate]
I am making a copy of a Dictionary<string, object> using the Dictionary<TKey,TValue>(IDictionary<TKey,TValue>) constructor. However, I found that the object values within the ...
0
votes
1
answer
139
views
cant Mapping Dictionary to Typed object using when object contain enum?
I need to convert Dictionary to object that contain enum but I got error
error : cant cast enum and i cant fix it
private static T DictionaryToObject<T>(IDictionary<string, string> dict) ...
0
votes
2
answers
309
views
Group dictionary values into objects in C#
I have a Dictionary<string, string> object that has the following template of values:
Key = "data[0][name]" | Value = "Test"
Key = "data[0][type]" ...
0
votes
1
answer
51
views
Dictionary<string,dynamic> behaves differently when used in function where built than when used out of function, why?
Using debug in VS 2019 on Windows Server 2019. I'm loading a Dictionary<string, dynamic> in a function to be used throughout the program. When I extract the dynamic object (o) from the ...
0
votes
1
answer
126
views
How to create dictionary within list
I have a class Mobile in which my dictionary is declared. I have another class Cell through which I want to call this dictionary and add items into it. I have created a function in the Mobile class to ...
-1
votes
3
answers
121
views
check if object already exists in Dictionary<string ,complexObject>
I have a dictionary :
public Dictionary<string, ComplexType> ListUserPerFloor { get; set; }
public class ComplexType
{
public string Id { get; set; }
public decimal Duration { get; set; }...
-1
votes
1
answer
424
views
Sorting Dictionary with child dictionary of object value type [duplicate]
I have a Dictionary<string, Dictionary<string, object>> that needs to be sorted depending on a certain value of the child dictionary.
e.g
{
"James": {
"Age": 21,
...
0
votes
1
answer
1k
views
C# Error CS1061 'object' does not contain a definition for 'parameters'
Trying rephrase and solve:
namespace Timing_Designer
{
public partial class TD : Form
{
Dictionary<string, dynamic> dictSignals = new Dictionary<string, dynamic>();
...
...
0
votes
1
answer
65
views
Compare Object vs Dictionary<int,List<int>> considering performance c#
using System;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApp5
{
class Validator
{
static void Main()
{
var metaValues = new List<Meta&...
0
votes
1
answer
178
views
Why object not act like reference type [duplicate]
I have problem with dictionary, i write simple code to explain that, can i achieve output 2 instead of 1?
I cannot use ref (because of TryGetValue)
static void Main(string[] args)
{
object j = ...
0
votes
1
answer
166
views
Insert new Dictionary entries of <UserStatus (enum), IEnumerable<string>> into different keys
we are doing the following programming exercise: Who's Online.
We have written the following code:
using System;
using System.Collections.Generic;
public static class Kata
{
public static ...
0
votes
1
answer
430
views
How to Convert Json Array to Single JSON object without using T object in C#?
I am looking for a one-liner that transforms the Json array [{},{}] into object => [{}].
I have the following serialized JSON string,
[
{
"Address": "Adresse"
},
{
"AddressDetails": "...