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

All Questions

Tagged with
0 votes
0 answers
33 views

Why is list of structs not IEnumerable<object>? [duplicate]

Running the below program gives the following output: Class is object. Class list is IEnumerable<object>. Struct is object. Struct list is not IEnumerable<object>. That implies that a ...
Amos Egel's user avatar
  • 1,106
1 vote
2 answers
167 views

C# Add List class to new List class without looping

I have a list of users returned in a class My Class: List public class EmployeeList { public int Emp_No { get; set; } public string Sys_Prefix { get; set; } public short Company_No { get; ...
Veronike Kitchen's user avatar
0 votes
0 answers
69 views

Unity setactive() not working because of object name

So I have a sort of item system in my game and it opens a savefile to see what items the player has at the time, when it loads it enables and disables objects based on the savefile information. Which ...
Bryan's user avatar
  • 1
-3 votes
1 answer
58 views

How to modify the object (textBox) that called the method from within the method itself?

EDIT: This question has been solved using "sender" (see answer below)--thank you to everyone who left comments! I'm trying to create a method that I can call within any number of text fields ...
BlakeWritesCode's user avatar
-1 votes
1 answer
48 views

In my C# project I get an string [,] type object as an output. When I want to print the output to console or file, the output is truncated. Why?

I have the method below, where I am subscribing to an OPC DA server items. public void read_OPC_items(string ip) { using (var client = new EasyDAClient()) { client.ItemChanged += ...
Mdarende's user avatar
  • 661
0 votes
1 answer
50 views

How can I convert (pass) an object that represents a two dimensional array to a 2-D array variable?

In my C# code I have an object in my code that represents a two dimensional array. I tried to write the value to a file by just converting it to string. I got something like an array but I saw the ...
Mdarende's user avatar
  • 661
1 vote
1 answer
26 views

C# Winforms: Recursive conversion from objet tree to TreeView duplicates entries

I'm trying to build a winforms TreeView from a tree of classes in C#, with the ability to select an item from the TreeView, by searching it's tag from the class structure. I've been trying to ...
Boyfinn's user avatar
  • 299
0 votes
1 answer
98 views

Return object property value inside a list, starting from a string

I have a list of objects where every object has a specific color. That list is defined under a unique variable as well, List<obj> listofobjs = new List<obj>(); What I'm trying to do is ...
desiredness's user avatar
0 votes
2 answers
154 views

Using LINQ, group list of object combination inside another list of objects

Update: Change class name as ComboProduct and Product for clear public class Product { public string Name {get; set;} } public class ComboProduct { public int Id; public List<Product&...
Khanh Nguyen Van's user avatar
0 votes
1 answer
51 views

Retrieve one object from a list of objects, but not by index[], but by a name of a field [duplicate]

At the end you can find the classes and Json file. How to retrieve one object from a list of objects, not by index[] but by a name of a field? I need to retrieve the full object. After I deserialize a ...
marcoqf73's user avatar
  • 1,324
0 votes
1 answer
52 views

How do I iterate through a list containing objects? c#

I created a list that stores objects from another class. The objects stored in my list each have a name and an integer. I want to know if I can iterate through my list and display the name of each ...
Ehab Nasir's user avatar
-1 votes
0 answers
35 views

Trouble with pickup physics in unity c# script

I am a beginner in unity scripting and I am having troubles with making a code on how to pick up an object. I have ran through 4-5 YouTube tutorials and still cannot manage to pick up objects. When I ...
Thomas's user avatar
  • 1
1 vote
1 answer
69 views

Access nested members in custom Settings-Class

I thought I had fully understood classes in C#, but atm I'm trying to create a custom Settings-Class for a Project of mine, but I just can't get it right. What I want to achieve: Have a class which ...
Madax's user avatar
  • 56
4 votes
2 answers
276 views

Difference between new() and new class() C#

What is the difference between new() and new class() because it seems that both run with no difference. Human John = new(); or Human John = new Human(); Let's say in this context it does not make ...
Dane's user avatar
  • 43
0 votes
0 answers
52 views

Creating object DLL(C#) in VBA

I've created dll and tlb file in C# to use it in VBA. Code for dll looks like this: using ModulPlanista.ServiceReference1; using System; using System.Collections.Generic; using System.Linq; namespace ...
gregor's user avatar
  • 11

15 30 50 per page