Skip to main content

All Questions

Tagged with
2 votes
2 answers
113 views

element-wise add / subtract / multiply / divide operation in two lists in C#

Considering element-wise add / subtract / multiply / divide operation in two lists. I have the code as follows. public class Calculate { public static IEnumerable<T> Add<T>(IEnumerable&...
JimmyHu's user avatar
  • 489
-2 votes
4 answers
114 views

Unable to cast List<T> to a class that is derived from List<T>

I have derived a class "ListOfT" from List<T> to have a place to put function that operate on a list of T. I have a function that iterates over the list and should return a sub-list of ...
AstaDev's user avatar
0 votes
3 answers
59 views

reading nested xml from file and using classes to store info

I have a project that has success criteria that is being stored in xml format, and then it gets compared with log data to determine if a build is successful. The xml contents is currently like this, ...
Michele's user avatar
  • 3,797
2 votes
2 answers
67 views

How do I print out the Linq values, that have been added to a List, instead of: "System.Collections.Generic.List`1[System.Int32]" in C#?

I am making a Three Or More game, which means that I need to make the programme recognise repeated values (for a 3 of a kind function). I have created a Die class that rolls a pseudorandom integer ...
Max Butler's user avatar
0 votes
2 answers
75 views

To check two lists for differences, should I use LINQ or ForEach? [closed]

I was stout enough to think that I understood the underlying question of the original OP. Here is my edited interpretation. Shoot me if I'm stepping out of line ;) I display a collection of objects. ...
Dilakshan AT's user avatar
-1 votes
2 answers
61 views

Update string items in a List only when the current string size is equals to 2 in c#

I have two lists, one of them is a list of 2 character strings (dteSubstringList). The other list is a variable string length list (table). I only want to update the items in the second list when the ...
Ulisses Farias's user avatar
2 votes
2 answers
72 views

Implementing List<T>, why wont it cast back to MyList after LINQ ? (Unable to cast object of type 'WhereListIterator`1)

Probably something silly that I'm missing, but so far searching has come up with nothing. I have implemented List<T> on my class, and when using a MyList.Where() function it wont cast back to a ...
Dirk Bourgeois's user avatar
0 votes
0 answers
33 views

Visual Studio watch time out

I am debugging a program in Microsoft Visual Studio 2019 Community, version 16.11.31. I'd like to "export" some list values to my editor for easier understanding. I tried to do this with ...
gtu's user avatar
  • 918
-2 votes
1 answer
64 views

Get the list from list of object using Linq dynamically in C#

I have an app with a list of objects. I want to create multiple lists from that single list, based on one of the parameters, dynamically. I have searched but could not find how to make it work exactly....
Manthan's user avatar
  • 3,832
0 votes
1 answer
85 views

How to merge common items from the nested list c#

I have the below list. This list needs to be self organized. Same "pname" catlist items with same categoryname items to be merged and needs to make it as single list as shown in the "...
ematech's user avatar
  • 11
0 votes
1 answer
77 views

dictionaries to tuple list

Short question. Is there a way to do this with Linq or any other default solution? Two dictionaries with same key but different values to a tuple list. The list should contain only values, where both ...
Master Silver's user avatar
0 votes
2 answers
118 views

Checking and Remove duplicates in a List of Objects C#

I'm looking for a way to check for duplicates and remove them in a list of objects using Linq query expression. First of all, I have two Objects: public class ErrorData { public string Severity { ...
JerryW's user avatar
  • 43
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
37 views

Returning a filtered list of items from where the ID is in a list from another array of matching guids

After a bit of help to get the a list filtered using another list of items. Ordinarily I'd of coded around this in SQL, but I need to try to get this working in .NET. I have a list of Roles, and each ...
Gavin Clayton's user avatar
0 votes
2 answers
79 views

In Linq, How to get list of parents that their children have a special age and other childern remove too?

I have two models: Parent and Child public class Parent { public int ID { get; set; } public string Name{ get; set; } public virtual ICollection Children { get; set; } } public class ...
NedaM's user avatar
  • 113

15 30 50 per page
1
2 3 4 5
191