All Questions
3,849
questions
0
votes
1
answer
47
views
Parse a text file into instances of an object
I'm currently working on a university assignment, and I have a problem with parsing text files into instances of an object. A simple explanation of the program I'm working on is a takeaway shop loader....
-3
votes
0
answers
42
views
How could I filter out a text file to add instances of an object? [closed]
I'm currently doing an assignment where I create a takeaway shop. People can load their own text files that has menus for different takeaway shops, for example one text file has the menu for one ...
-1
votes
1
answer
60
views
Adding simple logic in C# objects that are meant for one-time use [duplicate]
This is not a "how-to" question, but rather a "share your thoughts" question for senor C# developers. I'm a junior C# developer who has worked in C# for about a year (and in other ...
2
votes
1
answer
53
views
Why is object array null later in the script even after confirming its not null after initialization
The title. there are no mentions of the spriterenderers or array anywhere else in the program
SpriteRenderer[,] Renderer = new SpriteRenderer[8,8];
void Awake()
{
if (D)
{
...
0
votes
1
answer
118
views
Refit - FromForm / Multipart method not working with request object
I have a .NET 8 web API controller with the following endpoint method in it :
[HttpPost()]
[Route("someRoute")]
[ProducesResponseType(typeof(SomeResponse), StatusCodes.Status200OK)]
public ...
1
vote
1
answer
70
views
Access nested objects in C#
I am trying to access specific properties from my object via Google Books API. The content is deserialized into two POCOs to access the nested object. I am stuck on is accessing the properties of ...
-1
votes
2
answers
79
views
Is there a way to make a class with no limit on the number of Generic Type Parameters in c#? [duplicate]
I am working on a project in which I need to define any number of possible parameters when creating an object.
public class base
{
//Variable Declarations here...
public base(){ //Handle ...
0
votes
0
answers
19
views
Model Creation for Dynamic property in C# [duplicate]
Existing data:
existing = {
"MediaLRN" :'2',
"Media":'a.2',
"CultureDetails":{
"24 Hrs": [
{
"Organism": "15&...
0
votes
2
answers
52
views
How to check that there are no duplicates in an array? [duplicate]
I'm writing an application in C# that prompts the user for data for objects of an Automobile class. One of the properties of the class for which the program prompts the user for data is ID number. If ...
1
vote
1
answer
67
views
== and Equals for Tuple<object>
i have a question why it works like this
var a = new Tuple<object, object, object>(1, 1, 1);
var b = new Tuple<object, object, object>(1, 1, 1);
Console.WriteLine(a.Item1==b.Item1);//...
-1
votes
3
answers
85
views
Reading object value from other class in C#
I always have coded in C++ but I am learning C# now. I got a trouble with accessing the object value.
Here is what I tried.
class Program
{
static void Main(string[] args)
{
...
1
vote
3
answers
122
views
Using the object value in the class in C# [closed]
I always have coded in C++, but now trying to learn C#. I was trying to create multiple objects and use data of them in C#. However, it does not work in the way I desire.
Here is the code I tried.
...
0
votes
0
answers
46
views
Is there a way to return data from a database call as an general object rather than a specified type, without creating a new class
I have a function that is trying to return a list of all transactions from the database. To do this it needs to retrieve all the data from TransactionItems, and then join that to the data retrieved ...
1
vote
2
answers
49
views
Why is null Unity Object equal to null in specialized class but not equal to null in generic class?
Attach TestMono to an empty GameObject, leave the serialized field uov empty and play. The result is not what I expected.
using System;
using UnityEngine;
using Object = UnityEngine.Object;
namespace ...
1
vote
1
answer
383
views
C# "Smart Reference"/"Handles" allowing for an object to be "destroyed" immediately
I am working on a small scale game engine and have reached a point where I would like to destroy a Game Object (destroy meaning all references to an object become null). This is important because even ...
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 ...
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; ...
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 ...
-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 ...
-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 += ...
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 ...
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 ...
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 ...
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&...
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 ...
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 ...
-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 ...
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 ...
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 ...
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 ...