I wish to return enumerable items in order to bind the nested grid. Top grid displays Book Title and the nested grid displays the authors list of that book.
Author Collection
static public Author[] Authors =
{
new Author {FirstName="Johnny", LastName="Good"},
new Author {FirstName="Graziella", LastName="Simplegame"},
new Au...
I have a list of objects. These objects are made up of a custom class that basically contains two string fields (String1 and String2). What I need to know is if any of these strings are duplicated in that list. So I want to know if "objectA.String1 == objectB.String1", or "ObjectA.String2 == ObjectB.String2", or "ObjectA.String1 == Objec...
The same code on two different web sites (on the same solution), VB.Net (framework 3.5).
The Code:
Public Class UserTest
Public hhh As Integer
Public fff As String
Public Sub New(ByVal hh As Integer, ByVal ff As String)
Me.hhh = hh
Me.fff = ff
End Sub
End Class
Dim lst As List(Of UserTest) = N...
Hi, I'm having the following issue:
I'm using linq to filtrate some data in this way:
var listPerson = (from objPerson in ListPerson
select new
{
objPerson.IdPerson,
objPerson.ApePerson,
...
I want to do something like this:
Dim selectedCourses As List(Of Guid) = From item In chkListCourses.Items Where item.Selected = True Select item.Value
but I get the error:
Unable to cast object of type
'WhereSelectEnumerableIterator2[System.Object,System.Object]'
to type
'System.Collections.Generic.List1[System.Guid]'.
...
Hi Folks,
i've got the following code, which compiles but doesn't retrieve the correct results.
I'm trying to retrieve all the Banned log entries for people who have been recorded at cheating on a gaming server.
The database (in this case, two IList tables) has two simple tables.
GameFiles : the game which has a log file .. which w...
I have an IEnumerable of the following object:
public class Recipient
{
public int UserID { get; set; }
public string Name { get; set; }
}
So, I have an IEnumerable<Recipient> Recipients, and I'd like to do a .Contains() on Recipients. Except, I'd like to do a .contains() on each recipients UserID, to see if my Recipien...
I'm debating what technology to use for an upcoming ASP.NET project.
Assumptions:
I will be using Visual Studio 2008 SP1 (.NET Framework 3.5)
The back-end will be a SQL Server 2005 database (or possibly 2008)
Code will be written in C#
I already have experience with LinqToObjects and LinqToXml
I also have experience with ADO.NET and s...
I'm trying to write a simple program that will compare the files in separate folders. I'm currently using LINQ to Objects to parse the folder and would like to included information extracted from the string in my result set as well.
Here's what I have so far:
FileInfo[] fileList = new DirectoryInfo(@"G:\Norton Backups").GetFiles();
v...
Lets say I have a collection of Messages which has the properties "UserID" (int) and "Unread" (bool).
How can I use LINQ extension methods to set Unread = false, for any Message in the collection in whose UserID = 5?
So, I know I can do something like:
messages.Any(m => m.UserID == 5);
But, how do I set the Unread property of each o...
I have a listbox and I want its ItemsSource to be all the items of an ObservableCollection + an additional static text such as "All Items."
Right now I just have something similar to:
listbox1.ItemsSource = from Car c in Cars
select c.Model
I know I could just manually add the text to the listbox, but I want it...
I have an object, that has many properties but the only two to worry about are:
myobject.ID which is an int
myobject.Names which is a HashSet
Then I have a List of those objects that looks something similar to this:
List<myobject>
I use Linq to get a some of the data into a repeater, but I'm not sure how to get the list of Names and...
I have a pretty complex Linq statement with multiple joins, but am having a problem with an orderby statement.
I think I can reduce the question down a bit, but will expand if needed.
First my object has the following properties:
myObject.ID This is a basic Int
myObject.BrandName This is my HashSet<string>.
I need to sort my Object ...
I know there are a lot of examples of this on the web, but I can't seem to get this to work.
Let me try to set this up, I have a list of custom objects that I need to have limited on a range of values.
I have a sort variable that changes based on some action on the UI, and I need to process the object differently based on that.
Here...
Hi,
I am completely at a loss for why linq is throwing an Unable to cast object of type 'System.Int32' to type 'System.String' exception. The code is part of a generic function meant to pull the DataTextField and DataValueField out of an untyped DataTable and place them in a list of KeyValuePair(of string, string). I added a for each lo...
I have a statment like this:
foreach (var container in modelEntities.
Where(me => me.Value.ModelEntityType == (int)EntityType.Container))
Now I want to add an or clause to this where statement, however I can't seem to be able to do it.
Is there a way? or do I have to do the
var containers = (from me in modelEntities
whe...
I have the following test code to search a generic list:
public void DoSearch(string searchTerm)
{
IList<MyEntity> entities = GetCollectionOfEntities();
IList<MyEntity> results = entities.Where(d => d.Description.Contains(searchTerm)).ToList();
}
I want to pass an order by parameter (which would be a property of MyEntity) and of co...
Consider these two structures:
struct Task
{
public Int32 Id;
public String Name;
public List<Registration> Registrations;
}
struct Registration
{
public Int32 Id;
public Int32 TaskId;
public String Comment;
public Double Hours;
}
I am selecting a bunch of entries in a DataTable into new structures, like s...
I sometimes do this:
XElement.Descendants("mynodename");
is there a way to do something like this"
XElement.Descendants("mynodename or myothernodename");
...
I have a WCF Service. It uses Linq-to-objects to select from a Dictionary. The object type is simple:
public class User
{
public Guid Id;
public String Name;
}
There is a collection of stored in a Dictionary<Guid,User>.
I want to have a WCF OperationContract method like this:
public IEnumerable<Guid> GetAllUsers()
{
...