Linq Joining IEnumerable(Of Struct) to IEnumerable(of object)?

Give this a try: var query = from rowA in roles where roleIds. Contains(rowA. RoleId) select rowA.RoleName.

Works fine, thanks – CRice May 22 '09 at 0:39.

I would personally not use Jeremy's answer if you've got a significant number of Guids. If a join is what you really want to express - you just need: var query = from rowA in roles join rowB in roleIds on rowA. RoleId equals rowB select rowA.

RoleName; Alternatively, create a set of role IDs first: HashSet validRoleIds = new HashSet(roleIds); var query = from rowA in roles where validRoleIds. Contains(rowA. RoleId) select rowA.

RoleName; The advantage is that then you don't need to do a linear search through every valid role ID for every role. That's not an issue if you know you don't have many roles or role IDs, but generally a hashing approach will be more effective. Note that the join will use a hash as well internally.

Appreciate the reply, thanks. Am pretty new to linq but liking it more and more. – CRice May 22 '09 at 11:54.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions