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

All Questions

Tagged with
-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 ...
Zacc's user avatar
  • 23
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 ...
Johan Cloete's user avatar
-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) { ...
Euijin Jung's user avatar
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. ...
Euijin Jung's user avatar
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
1 answer
25 views

C# Trying to use a method to assign attributes of an old object to new objects

I'm new to c# and programing in general, like a few weeks, and this has stumped me. The code below is the one I'm having trouble with. internal class Program { static void Main(string[] ...
kenLeeDep's user avatar
1 vote
1 answer
240 views

How can I read the name of a thread in a C# application?

I'm working on a multithreaded application, written in C#. I would like to verify if a thread is already running or not. You might think "How easy can that be?", but there seems to be a ...
Dominique's user avatar
  • 17.2k
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
0 answers
131 views

(C#) How can I access a property of the parent class?

I want to access a property of my master object. Here, after instantiating the class City, I want to know the country this city belongs to. public class Country { public string NameOfCountry { get;...
user1448393's user avatar
0 votes
3 answers
115 views

Converting a C# class I created inside a project to a separate reusable class

I'm not new to C# programming, but I suppose I'm new to programing "the right way" in C#. I've worked in C on embedded devices for years and have written desktop apps to support them. First ...
VinDag's user avatar
  • 55
-4 votes
1 answer
79 views

making instance of class in c# [closed]

In this code using System; namespace Hello { class TestEmployee { static void Main() { Employee employee = new Employee(); employee.salary = 1000; ...
Amirreza's user avatar
-1 votes
2 answers
400 views

How can I match a specific existing object by a string property?

I am trying to make a query system for objects, but I have been unable to figure out how to turn a string from Console.ReadLine() to an object's name. Here is an example code snippet: class Program { ...
Taxolotl's user avatar
1 vote
1 answer
535 views

c# Create a class with a method that outputs title and author, create objects and call the method

This is an assignment I have in c#: "Create a class called Book that defines attributes Title, Author, and Year. Add a method called Display() that outputs the Title and Author. Demonstrate ...
Emily Flood'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

15 30 50 per page
1
2 3 4 5
28