generic-list Questions
4
Is it possible to put a [Required] attribute onto a List<> property?
I bind to a generic list on POST and was wondering if I could make ModelState.IsValid() fail if the property has 0 items in ...
Hoot asked 21/6, 2011 at 16:41
3
Solved
Jersey 1.6 can produce:
@Path("/stock")
public class StockResource {
@GET
@Produces(MediaType.APPLICATION_JSON)
public List<Stock> get() {
Stock stock = new Stock();
stock.setQuantity(3...
Pennipennie asked 21/5, 2011 at 11:53
6
Solved
I have two List<T> objects:
For example:
List 1:
ID, Value where Id is populated and value is blank and it contains say IDs from 1 to 10.
1,""
2,""
...
10,""
List 2:
ID, Value and other at...
Badoglio asked 19/8, 2009 at 9:45
5
Solved
I came across this statement:
"When using foreach on a list of objects, the iterated object instance is not editable, but the object properties are editable"
Could someone demonstrate the abov...
Sabin asked 29/6, 2016 at 12:19
2
Solved
Somewhere in my code I have an object that I already know that is a list. But I don't know the type parameter of that list. I need to iterate over it's items. I tried to cast that object to a list ...
Appling asked 11/1, 2016 at 6:53
3
Solved
Consider the following partial view code snippet
List<sellingPrice> Prices = ViewBag.Prices;
foreach (var mgmp in mg.messageGroup.messageGroupMessagePLUs)
{
if (Prices.Any(x => x.pluId =...
Dornick asked 16/1, 2013 at 15:14
4
In the following code Java, I have created a list nums. I can assign the another list during the declaration. But new items cannot be added except the null. So, does it mean the nums is readonly? W...
Rood asked 16/9, 2015 at 16:53
3
Solved
I have BindingList object which is attched with DataGridView.
BindingList<FilesToProcessDataModels> Listfiles = new BindingList<FilesToProcessDataModels>();
dataGridFiles.DataSource = ...
Adriel asked 5/12, 2013 at 11:30
2
Solved
I read this code:
List<long> userIdList = new List<long>();
But I jumped to the definition(use VS2012) of List (in System.Collections.Generic), I found:
public class List<T> :...
Venice asked 8/7, 2015 at 7:21
2
Solved
I'm doing the synchronization between the two lists.
IList<Event> GoogleEvents and Table<myEvent> DB.Events;
On google side i'm using this
String Summary,
String Description,
EventDa...
Loathly asked 10/7, 2014 at 8:31
1
Solved
Why is IList defined like this?
public interface IList<T> : ICollection<T>, IEnumerable<T>, IEnumerable
public interface ICollection<T> : IEnumerable<T>, IEnum...
Ultraism asked 20/3, 2015 at 6:44
4
Solved
I would be certain that this question addresses something that would have been brought up in a previous question, but I was unable to find it.
There is a method in a C# class that takes as a param...
Rosamariarosamond asked 26/3, 2009 at 15:36
2
Solved
Is there a built-in method to convert the .NET List<> into the F# list?
Conn asked 23/6, 2010 at 20:14
10
Solved
I have a set of elements/keys which I'm reading from two different config files. So the keys may be same but with different values associated with each of them.
I want to list them in the sorted o...
Fairleigh asked 5/8, 2010 at 12:15
2
Solved
ArrayList, which I use in legacy Compact Framework code, does not seem to be available in newfangled (.NET 4.5.1) code.
I am storing instances of custom classes in it.
What is a good replacement ...
Herne asked 21/3, 2014 at 21:52
5
Solved
I have a generic list that I'm removing items out of using List.Remove(Object). I have been removing items but whenever I get to the fifth item I'm removing it fails and does not remove it from the...
Delagarza asked 17/12, 2009 at 16:35
3
In terms of speed in search, is it better to search the keys of a dictionary or the values of a list?
In other words, which of these would be most preferable?
Dictionary<tring,string> dic ...
Deviation asked 27/1, 2014 at 22:55
2
Solved
I build my list like this:
public static List<SearchFormula> SearchData(string searchString)
{
var searchResults = new List<SearchFormula>();
SqlDataReader drResults = FormulaUtilit...
Clapperclaw asked 16/12, 2013 at 21:6
3
Solved
Suppose we have a class called Dog with two strings "Name" and "Id". Now suppose we have a list with 4 dogs in it. If you wanted to change the name of the Dog with the "Id" of "2" what would ...
Dode asked 9/10, 2013 at 19:34
2
Solved
In my Visio 2007 UML document I am unable to figure out how I can add an operation to an Interface that returns a generic List<MyCustomType> type.
For example:
Say I have a class named "MyC...
Ivory asked 5/1, 2012 at 19:13
1
Solved
I'm looking for a way to pass in a list of strongly typed property names into a method that I can then dissect and get the properties that the caller is interested in. The reason I want to do this ...
Cell asked 11/6, 2013 at 11:11
2
Solved
(This question arises from a discussion that started here)
I was comparing the timings for looking for a true value in a List<bool> using List.Contains() with those for a hand-rolled loop.
...
Tympanites asked 17/4, 2013 at 14:0
1
Solved
Does freeing generic lists like TList<string>, TList<Double>, TList<Integer> or TList<TMyRecord>, where TMyRecord is declared like:
type
TMyRecord = record
MyString: stri...
Suite asked 29/3, 2013 at 16:8
2
Solved
I'm currently making my own very basic generic list class (to get a better understanding on how the predefined ones work). Only problem I have is that I can't reach the elements inside the array as...
Euchologion asked 19/2, 2013 at 16:24
3
Solved
Imagine this struct :
struct Person
{
public string FirstName { get; set; }
public string LastName { get; set; }
}
And following code :
var list = new List<Person>();
list.Add(new ...
Hermosa asked 18/2, 2013 at 20:55
© 2022 - 2024 — McMap. All rights reserved.