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

All Questions

Tagged with
1 vote
3 answers
510 views

Trying to add a node to a graph

I am implementing a Graph via adjacency list, and I am trying to add a node to a Graph class but I keep getting an error System.NullReferenceException has been thrown this is the bit of my code: ...
Grimmace_23's user avatar
0 votes
1 answer
196 views

when trying to iterate a list of objects which contains a list of object and if i add a value to inner list all objects get same value

my code is like this: for(updatedDetails ud in meUD) { Details s = 8; ud.Details.add(s); } meUD is List of object updatedDetails which has a list of object Details If I run that loop, instead of ...
shashank uttam's user avatar
-2 votes
2 answers
221 views

Object as a parameter without declaring a variable

Why is it possible to create a new object and use it as a parameter WITHOUT declaring "pathVariable"? ExcelPkg.SaveAs(new FileInfo(@"D:\New.xlsx")) Otherwise, code below causes an ...
fysharp's user avatar
  • 101
-4 votes
2 answers
142 views

What is the cleanest way to abort a construction of a new object in c#, and instead return a reference to an object that already exists?

I would like for a constructor to somehow abort the construction of a new object, and instead return a reference to an object that already exists. What is the cleanest way to do this?
NERL's user avatar
  • 292
0 votes
0 answers
80 views

Are instances and objects the same thing? [duplicate]

I keep hearing the words instances and objects, don't they have the same meaning or not? For example, if I want to initialize an object of a class, I use the new operator to initialize an object with ...
Sandra James's user avatar
0 votes
1 answer
498 views

Accessing value of object/instance of a class, made by using method from another class

I've been trying to do this multiple times in my recent project, since I'm currently experimenting on how can I keep my main function in the main class as clean and tidy as possible, while making use ...
C0deN00b's user avatar
0 votes
1 answer
76 views

Unable to call method's objects into the Form

As you can see I instantiated the classes I need into the form_load, in order to use methods and classes features. The problem is that I need to Call the item NuovoCliente from CreateClientemethod, ...
notsosmart's user avatar
0 votes
1 answer
60 views

Is there a difference between an Instance and an Object in C#? [closed]

I'm studying the OOP aspect of C# and I would like to know if there is a difference between and Instance and an Object?
Arayik Hovhannisyan's user avatar
0 votes
2 answers
45 views

C# Object Intantiation format question declaring a variable vs not declaring a variable [closed]

I am new to C# and I think I am seeing 2 diferent ways to do the same thing or maybe I just am not understanding. My "Murach's C# 2015" book has on page 369 an example of creating 2 object instances ...
XCELLGUY's user avatar
  • 179
1 vote
2 answers
511 views

Object instance from one class being changed from another class

I have a class called FrameSelector, which just stores a "path" to iframes on a web page. This class contains an instance of FramePath which is the actual path to the current frame. I instantiate an ...
user2640145's user avatar
0 votes
1 answer
561 views

C#: Multiple class instances all doing the same thing

I have 3 different classes: Entity, Control and Environment Inside the Entity class, I have a Control variable: readonly Control m_Control Inside the constructor of my Entity class, I'm ...
zineryt's user avatar
  • 43
0 votes
0 answers
35 views

Is there any way to search from list of instances and display a specific one with user input

I have created a class (C#) "class Car" and created 3 instances of that class. Car mycar,Car my2car,Car my3car.I have also given them the properties.Make,model,Year and Color. Like this (it is one of ...
ruralindian's user avatar
0 votes
4 answers
105 views

Add one object to multiple arrays and keep differences between each copy?

Basically, I want to create one object, and then add that object to a bunch of different arrays, and be sure that if one array changes the object's values, the other objects in other arrays don't ...
CaptainLost's user avatar
0 votes
1 answer
55 views

C# (wpf) after creating object instance i can not reuse it

I am working on small project, and I am trying to use object to store data. Its only: name, year and price to be stored (max 10 items). //On click I get user input and I create new object instance //...
Bournee's user avatar
  • 61
-1 votes
1 answer
132 views

Object’s Parent Current Instance

Having the following object(s): public class Employee { public string LastName { get; set; } = ""; internal class SubordinateList<T> : List<T>, IPublicList<T> where T : ...
Eric Marquis's user avatar

15 30 50 per page
1
2 3 4 5 6