All Questions
33
questions
1
vote
2
answers
160
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
20
views
Trying to add an Object to an arrayList specified elsewhere
Whilst trying to make a class which I can use to add any object to an ArrayList from outside it I ran in to this problem:
public class AddToArrayList
{
public ArrayList stack;
...
-1
votes
2
answers
98
views
Cast object to int[]
I have a array (with type of Object) which I'm extracting from a System.Collections.ArrayList. And I'm now trying to cast this object to a int[] so i can use it to compare it with another int[].
Note: ...
0
votes
1
answer
79
views
Need to use an ArrayList to store objects, assignment requires I use an ArrayList, struggling to call the methods of the object from the ArrayList
I have no idea how to describe my issue in the right terms, sorry.
My assignment is pretty simple, but I am having a tough time with an ArrayList in c#.
If I had an array of objects and that object ...
0
votes
1
answer
2k
views
C# accessing element of object from List<> using for loop instead of foreach
trying to brush up my foundation on C#. How do I print the value of objects from a List? I have a List and wants to print out the Name and Age to console.
I can use foreach loop to print them out ...
0
votes
1
answer
39
views
Can you choose a random List member from a collection based on properties of objects in said List?
I wrote a program to shuffle media in a folder because the media player I have, while it does support shuffling, doesn't remember what it already played so a lot of times I get repeats. I wrote my ...
0
votes
1
answer
41
views
How can I rewrite this code assigning a List of String to a Collection of an Object of String?
How may I rewrite this code to assign the elements of an array list to the elements of an object at once?
List<string> fileEntries = new List<string>
(Directory.EnumerateFileSystemEntries(&...
1
vote
2
answers
543
views
group inside a list of objects and modify
I got a list from a class like this:
List<clsLinkObject> FinalValsLinks = new List<clslinkObject>();
and the class contains:
public class clsLinkObject
{
public string ...
0
votes
1
answer
18
views
Question about handling of ArrayList with Objects
I want to use a dynamic number ob objects from another class as attributes in my Class "Company". For that I want to handle this with an ArrayList. Which of the following way works or is better? Or ...
0
votes
3
answers
845
views
How to iterate through and read values in an ArrayList of ArrayLists of objects in C#?
I want to iterate through an ArrayList containing ArrayLists of different object type and write the data to a console.
I tried to use IEnumerable and foreach-loop.
//-------------------- Custom ...
-2
votes
1
answer
91
views
Does expanding arraylist of objects make a new object?
Assume we have an array list of type Employe , does expanding it's length by 1 make a new object in the list ?
is the code in else statement correct? and is it recommended?
public void ...
-1
votes
1
answer
60
views
Reverse sorting of arrays [duplicate]
I'm having trouble sorting this list of objects in reverse, the below code works well in ascending order.
DC d = new DC();
var t = d.GetList();
t.Sort((s1, s2) => DateTime.Compare(DateTime....
1
vote
0
answers
49
views
How to add an object containing an arraylist to another arraylist, C#?
I am making a windows application in C# which reads in data about car hire companies from a text file and outputs the information in two listboxes (Companies and cars). there are 2 classes Company and ...
0
votes
2
answers
1k
views
How to return an ArrayList from a WebService in C#?
I have been trying to return an ArrayList from a WebService and I am confused about how to get it going as I get an error message saying
"Cannot implicitly convert type 'object[]' to 'System....
-1
votes
1
answer
2k
views
C# using ArrayList from another class
I have one class Racun.cs
public class Racun
{
private string _nazivKupca;
public string NazivKupca
{
get
{
return _nazivKupca;
}
set
{
...