Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
0 votes
1 answer
141 views

How to find out the size of an object recursively in c#?

I have a complex object with properties that range from int, double, string, List of objects, Dictionary<sting, dynamic> ,etc. How can I calculate the size of this object (without using GC) ? I'...
Curry's user avatar
  • 1
0 votes
1 answer
54 views

A property in Child Object in Parent Object-A is changed when a new property in Child Object in Parent Object-B is added

Consider this object { "ClassId": 101, "Sections": [ { "SectionId": 201, "Subjects": [ { ...
Code Toddler's user avatar
2 votes
2 answers
279 views

Getting all values of properties of an object into an array in c#

Im trying to get all the field values of an object into an array. but the problem is the fields of the object can have other types rather than string but ultimately all the values should be a string. ...
DBankx's user avatar
  • 21
0 votes
2 answers
88 views

List<object>: how to apply a "where" for some index element?

I've this kind of List of object: .AsEnumerable().Select(p => new List<object>() { p.ID, p.DateActivity.HasValue ? p.DateActivity.Value.ToString("yyyyMMdd") : null, p....
markzzz's user avatar
  • 47.4k
-1 votes
2 answers
43 views

Need clarity over what happens when you cast an object to value or reference type compared to using Dynamic in a class property, Using C#

So have this property Value in a class. I need an interchangeable type of property for Value as wont know the type until it arrives from the DB and can be either reference or value type (see examples ...
Manity's user avatar
  • 47
0 votes
0 answers
117 views

How to convert list of objects into string and then into byte array

The list contains two objects or more I want to create string with the name of its properties and values. async Task<string> ICsvHandler.CsvHandler() { var employees = new List<...
Shivam Dubey's user avatar
0 votes
1 answer
94 views

C# - Object without '= new Kid()'

Goodmorning. How is it possible at the line 28 and 29 the kd has the ability to use the property and the function without using 'Kid kd = new Kid();' at the line 24. Normally i get the error at the ...
gianestras's user avatar
0 votes
1 answer
61 views

Using a subset of an object in different services

lets say that I have a system that heavily relies on a single object, for example a Person. I have a storage service (service 1) that handles basic CRUD operations for Person, and saves this person in ...
arebok2's user avatar
0 votes
1 answer
228 views

How to get data from an Object from another Class?

Hey I have a problem with my code. Sorry if the question is too easy but I can't find a solution. I have an object called user in class 1 The Object User has this variables. public class User { ...
obind's user avatar
  • 165
-2 votes
1 answer
330 views

Convert JSON file into multiple class objects in C#

I'm trying to make a program in C# that allows me to edit level data in JSON: { "ambienceSettings": { "fogDDensity": 0.57235307, "skyHorizonColor": { ...
goteki's user avatar
  • 9
0 votes
2 answers
83 views

Can you change the default value for a user created class c#

I'm making a game and the background is made of Tile objects. The Tile parent is abstract but I have Tile arrays to hold the children. When I make a Tile array I want it to assume that any unspecified ...
EtherealChilly's user avatar
-1 votes
1 answer
489 views

AutoMapper - Map from object to enum

I have this class: public class EntityClass { public bool IsExempt { get; set; } public bool IsOverdue { get; set; } public SourceEnum Status { get; set; } } And these two enums: public ...
John Jwick's user avatar
1 vote
1 answer
2k views

How can we deserialize JSON data to c# object from API response

I need to deserialize my json data. I am using Newtonsoft.Json for json operations. I tried a lot of method to deserialize this data but i failed. Btw, I need to summarize my system for better ...
Mert Atmaca's user avatar
0 votes
3 answers
518 views

Method that takes two different objects

So i have two different objects, with different properties: public class ModelA : IServices { public string Id { get; set; } public ServiceType ServiceType { get; set; } (Enum) ...
byteArrayJake's user avatar
0 votes
0 answers
226 views

object reference not set to an instance of an object : source

I have an object named "groupRead", which is null so that's why it's throwing an exception of "object reference not set to an instance of an object" when I'm trying to access this ...
thrainder's user avatar

15 30 50 per page
1
2 3 4 5
20