Why I can't get the selected value?
I have two ComboBox
for Employee
& PayrollName
.
on the first ComboBox
('PayrollName'), using SelectedValue
is fine but when it comes to the next ComboBox
I get this error:
Conversion from type 'VB$AnonymousType_11(Of Integer,String)' to type 'Integer' is not valid
I have tried to search for the error but no luck, I can't find even one
My code for loading data to my Employee
ComboBox
Dim _list = MyContext.Employees.Where(Function(q) q.Status = True).Select(Function(q) New With
{
q.EID,
.Name = q.Lastname & ", " & q.Firstname
}).ToList
Dim list = _list.OrderBy(Function(x) x.Name).ToList()
With cbxEmployee
.DataSource = list.ToList
.DisplayMember = "Name"
.ValueMember = "EID"
End With
My code for getting the SelectedValue
Dim EmployeeID As Integer = cbxEmployee.SelectedValue
Why I can't get the selected value?
Sorry I am not that good in english
vb.net combobox selectedvalue
add a comment |
I have two ComboBox
for Employee
& PayrollName
.
on the first ComboBox
('PayrollName'), using SelectedValue
is fine but when it comes to the next ComboBox
I get this error:
Conversion from type 'VB$AnonymousType_11(Of Integer,String)' to type 'Integer' is not valid
I have tried to search for the error but no luck, I can't find even one
My code for loading data to my Employee
ComboBox
Dim _list = MyContext.Employees.Where(Function(q) q.Status = True).Select(Function(q) New With
{
q.EID,
.Name = q.Lastname & ", " & q.Firstname
}).ToList
Dim list = _list.OrderBy(Function(x) x.Name).ToList()
With cbxEmployee
.DataSource = list.ToList
.DisplayMember = "Name"
.ValueMember = "EID"
End With
My code for getting the SelectedValue
Dim EmployeeID As Integer = cbxEmployee.SelectedValue
Why I can't get the selected value?
Sorry I am not that good in english
vb.net combobox selectedvalue
Why do you callToList
for the first expression? You could save yourself a bunch of memory by leaving that off.
– Joel Coehoorn
Nov 20 '18 at 19:53
add a comment |
I have two ComboBox
for Employee
& PayrollName
.
on the first ComboBox
('PayrollName'), using SelectedValue
is fine but when it comes to the next ComboBox
I get this error:
Conversion from type 'VB$AnonymousType_11(Of Integer,String)' to type 'Integer' is not valid
I have tried to search for the error but no luck, I can't find even one
My code for loading data to my Employee
ComboBox
Dim _list = MyContext.Employees.Where(Function(q) q.Status = True).Select(Function(q) New With
{
q.EID,
.Name = q.Lastname & ", " & q.Firstname
}).ToList
Dim list = _list.OrderBy(Function(x) x.Name).ToList()
With cbxEmployee
.DataSource = list.ToList
.DisplayMember = "Name"
.ValueMember = "EID"
End With
My code for getting the SelectedValue
Dim EmployeeID As Integer = cbxEmployee.SelectedValue
Why I can't get the selected value?
Sorry I am not that good in english
vb.net combobox selectedvalue
I have two ComboBox
for Employee
& PayrollName
.
on the first ComboBox
('PayrollName'), using SelectedValue
is fine but when it comes to the next ComboBox
I get this error:
Conversion from type 'VB$AnonymousType_11(Of Integer,String)' to type 'Integer' is not valid
I have tried to search for the error but no luck, I can't find even one
My code for loading data to my Employee
ComboBox
Dim _list = MyContext.Employees.Where(Function(q) q.Status = True).Select(Function(q) New With
{
q.EID,
.Name = q.Lastname & ", " & q.Firstname
}).ToList
Dim list = _list.OrderBy(Function(x) x.Name).ToList()
With cbxEmployee
.DataSource = list.ToList
.DisplayMember = "Name"
.ValueMember = "EID"
End With
My code for getting the SelectedValue
Dim EmployeeID As Integer = cbxEmployee.SelectedValue
Why I can't get the selected value?
Sorry I am not that good in english
vb.net combobox selectedvalue
vb.net combobox selectedvalue
edited Nov 20 '18 at 19:55
Joel Coehoorn
309k95494728
309k95494728
asked Nov 20 '18 at 19:26
kieloukielou
299113
299113
Why do you callToList
for the first expression? You could save yourself a bunch of memory by leaving that off.
– Joel Coehoorn
Nov 20 '18 at 19:53
add a comment |
Why do you callToList
for the first expression? You could save yourself a bunch of memory by leaving that off.
– Joel Coehoorn
Nov 20 '18 at 19:53
Why do you call
ToList
for the first expression? You could save yourself a bunch of memory by leaving that off.– Joel Coehoorn
Nov 20 '18 at 19:53
Why do you call
ToList
for the first expression? You could save yourself a bunch of memory by leaving that off.– Joel Coehoorn
Nov 20 '18 at 19:53
add a comment |
2 Answers
2
active
oldest
votes
The first statement in the code includes this lambda expression:
Function(q) New With
{
q.EID,
.Name = q.Lastname & ", " & q.Firstname
}
It generates an anonymous type with an Integer field (EID) and a String field (Name). That's the VB$AnonymousType_11(Of Integer,String)
you see in the error message. These values are assigned to the combobox, and so when you look at the SelectedValue
for the ComboBox, that's the kind of value you're working with.
So you need to do this:
Dim EmployeeID As Integer = cbxEmployee.SelectedValue.EID
EVEN BETTER
That only works because Option Strict
is turned off, and that's very bad. It leads to all kinds of runtime errors. You should turn Option Strict on. That will seem to raise a bunch of new errors is you code, but every single one is really a little time bomb waiting to go off. This gives you the chance to fix those errors now, before they cause a problem for you users. You'll end up with better, faster code, that's easier to maintain.
In this case, that might mean defining a Class
for these list objects, which seems like a big deal but it's really only four lines of code:
Public Class EmployeeListItem
Public Property EID As Integer
Public Property Name As String
End Class
Then I would further set the DisplayMember and ValueMember items before assigning the DataSource. Combine with other fixes, and you get this:
Dim list = MyContext.Employees.
Where(Function(q) q.Status = True).
Select(Function(q) New EmployeeListItem With
{
q.EID,
.Name = q.Lastname & ", " & q.Firstname
}).
OrderBy(Function(x) x.Name)
With cbxEmployee
.DisplayMember = "Name"
.ValueMember = "EID"
.DataSource = list
End With
Notice I never had to call ToList()
. This reduces memory use, and in some cases can make the code greatly more efficient.
Then, when using the value, you want to cast it, like this:
Dim EmployeeID As Integer = DirectCast(cbxEmployee.SelectedValue, EmployeeListItem).EID
I have tried to includeEmployeeListItem
to my expression and I got an error in theSelect
part
– kielou
Nov 20 '18 at 20:19
You have to define the class, too.
– Joel Coehoorn
Nov 20 '18 at 20:20
I already did define the class
– kielou
Nov 20 '18 at 20:25
I didn't solved my problem with this but because of this I gained some ideas how to solve and other problems too. Thank you so much for the explanation. I really appreciated it
– kielou
Nov 21 '18 at 3:10
add a comment |
Try turning Option Strict On. SelectedValue isn't an integer and can't be directly inserted in an integer. In this case, it is returning the object of the AnonymousType that you created. You would need decided .Name or .EID
I just tried to do your suggestion turning Option Strict On but it didn't work
– kielou
Nov 20 '18 at 19:39
@kielou Option Strict On won't fix the problem, it will help you see the errors. You still need to specify that you want the EID.
– the_lotus
Nov 20 '18 at 19:40
Oh. Sorry but how can I specify that I want the EID?
– kielou
Nov 20 '18 at 19:45
@kielou how you tried cbxEmployee.SelectedValue.EID ?
– the_lotus
Nov 20 '18 at 19:50
yes and it saysObject variable or With block variable not set
– kielou
Nov 20 '18 at 19:59
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53400163%2fwhy-i-cant-get-the-selected-value%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
The first statement in the code includes this lambda expression:
Function(q) New With
{
q.EID,
.Name = q.Lastname & ", " & q.Firstname
}
It generates an anonymous type with an Integer field (EID) and a String field (Name). That's the VB$AnonymousType_11(Of Integer,String)
you see in the error message. These values are assigned to the combobox, and so when you look at the SelectedValue
for the ComboBox, that's the kind of value you're working with.
So you need to do this:
Dim EmployeeID As Integer = cbxEmployee.SelectedValue.EID
EVEN BETTER
That only works because Option Strict
is turned off, and that's very bad. It leads to all kinds of runtime errors. You should turn Option Strict on. That will seem to raise a bunch of new errors is you code, but every single one is really a little time bomb waiting to go off. This gives you the chance to fix those errors now, before they cause a problem for you users. You'll end up with better, faster code, that's easier to maintain.
In this case, that might mean defining a Class
for these list objects, which seems like a big deal but it's really only four lines of code:
Public Class EmployeeListItem
Public Property EID As Integer
Public Property Name As String
End Class
Then I would further set the DisplayMember and ValueMember items before assigning the DataSource. Combine with other fixes, and you get this:
Dim list = MyContext.Employees.
Where(Function(q) q.Status = True).
Select(Function(q) New EmployeeListItem With
{
q.EID,
.Name = q.Lastname & ", " & q.Firstname
}).
OrderBy(Function(x) x.Name)
With cbxEmployee
.DisplayMember = "Name"
.ValueMember = "EID"
.DataSource = list
End With
Notice I never had to call ToList()
. This reduces memory use, and in some cases can make the code greatly more efficient.
Then, when using the value, you want to cast it, like this:
Dim EmployeeID As Integer = DirectCast(cbxEmployee.SelectedValue, EmployeeListItem).EID
I have tried to includeEmployeeListItem
to my expression and I got an error in theSelect
part
– kielou
Nov 20 '18 at 20:19
You have to define the class, too.
– Joel Coehoorn
Nov 20 '18 at 20:20
I already did define the class
– kielou
Nov 20 '18 at 20:25
I didn't solved my problem with this but because of this I gained some ideas how to solve and other problems too. Thank you so much for the explanation. I really appreciated it
– kielou
Nov 21 '18 at 3:10
add a comment |
The first statement in the code includes this lambda expression:
Function(q) New With
{
q.EID,
.Name = q.Lastname & ", " & q.Firstname
}
It generates an anonymous type with an Integer field (EID) and a String field (Name). That's the VB$AnonymousType_11(Of Integer,String)
you see in the error message. These values are assigned to the combobox, and so when you look at the SelectedValue
for the ComboBox, that's the kind of value you're working with.
So you need to do this:
Dim EmployeeID As Integer = cbxEmployee.SelectedValue.EID
EVEN BETTER
That only works because Option Strict
is turned off, and that's very bad. It leads to all kinds of runtime errors. You should turn Option Strict on. That will seem to raise a bunch of new errors is you code, but every single one is really a little time bomb waiting to go off. This gives you the chance to fix those errors now, before they cause a problem for you users. You'll end up with better, faster code, that's easier to maintain.
In this case, that might mean defining a Class
for these list objects, which seems like a big deal but it's really only four lines of code:
Public Class EmployeeListItem
Public Property EID As Integer
Public Property Name As String
End Class
Then I would further set the DisplayMember and ValueMember items before assigning the DataSource. Combine with other fixes, and you get this:
Dim list = MyContext.Employees.
Where(Function(q) q.Status = True).
Select(Function(q) New EmployeeListItem With
{
q.EID,
.Name = q.Lastname & ", " & q.Firstname
}).
OrderBy(Function(x) x.Name)
With cbxEmployee
.DisplayMember = "Name"
.ValueMember = "EID"
.DataSource = list
End With
Notice I never had to call ToList()
. This reduces memory use, and in some cases can make the code greatly more efficient.
Then, when using the value, you want to cast it, like this:
Dim EmployeeID As Integer = DirectCast(cbxEmployee.SelectedValue, EmployeeListItem).EID
I have tried to includeEmployeeListItem
to my expression and I got an error in theSelect
part
– kielou
Nov 20 '18 at 20:19
You have to define the class, too.
– Joel Coehoorn
Nov 20 '18 at 20:20
I already did define the class
– kielou
Nov 20 '18 at 20:25
I didn't solved my problem with this but because of this I gained some ideas how to solve and other problems too. Thank you so much for the explanation. I really appreciated it
– kielou
Nov 21 '18 at 3:10
add a comment |
The first statement in the code includes this lambda expression:
Function(q) New With
{
q.EID,
.Name = q.Lastname & ", " & q.Firstname
}
It generates an anonymous type with an Integer field (EID) and a String field (Name). That's the VB$AnonymousType_11(Of Integer,String)
you see in the error message. These values are assigned to the combobox, and so when you look at the SelectedValue
for the ComboBox, that's the kind of value you're working with.
So you need to do this:
Dim EmployeeID As Integer = cbxEmployee.SelectedValue.EID
EVEN BETTER
That only works because Option Strict
is turned off, and that's very bad. It leads to all kinds of runtime errors. You should turn Option Strict on. That will seem to raise a bunch of new errors is you code, but every single one is really a little time bomb waiting to go off. This gives you the chance to fix those errors now, before they cause a problem for you users. You'll end up with better, faster code, that's easier to maintain.
In this case, that might mean defining a Class
for these list objects, which seems like a big deal but it's really only four lines of code:
Public Class EmployeeListItem
Public Property EID As Integer
Public Property Name As String
End Class
Then I would further set the DisplayMember and ValueMember items before assigning the DataSource. Combine with other fixes, and you get this:
Dim list = MyContext.Employees.
Where(Function(q) q.Status = True).
Select(Function(q) New EmployeeListItem With
{
q.EID,
.Name = q.Lastname & ", " & q.Firstname
}).
OrderBy(Function(x) x.Name)
With cbxEmployee
.DisplayMember = "Name"
.ValueMember = "EID"
.DataSource = list
End With
Notice I never had to call ToList()
. This reduces memory use, and in some cases can make the code greatly more efficient.
Then, when using the value, you want to cast it, like this:
Dim EmployeeID As Integer = DirectCast(cbxEmployee.SelectedValue, EmployeeListItem).EID
The first statement in the code includes this lambda expression:
Function(q) New With
{
q.EID,
.Name = q.Lastname & ", " & q.Firstname
}
It generates an anonymous type with an Integer field (EID) and a String field (Name). That's the VB$AnonymousType_11(Of Integer,String)
you see in the error message. These values are assigned to the combobox, and so when you look at the SelectedValue
for the ComboBox, that's the kind of value you're working with.
So you need to do this:
Dim EmployeeID As Integer = cbxEmployee.SelectedValue.EID
EVEN BETTER
That only works because Option Strict
is turned off, and that's very bad. It leads to all kinds of runtime errors. You should turn Option Strict on. That will seem to raise a bunch of new errors is you code, but every single one is really a little time bomb waiting to go off. This gives you the chance to fix those errors now, before they cause a problem for you users. You'll end up with better, faster code, that's easier to maintain.
In this case, that might mean defining a Class
for these list objects, which seems like a big deal but it's really only four lines of code:
Public Class EmployeeListItem
Public Property EID As Integer
Public Property Name As String
End Class
Then I would further set the DisplayMember and ValueMember items before assigning the DataSource. Combine with other fixes, and you get this:
Dim list = MyContext.Employees.
Where(Function(q) q.Status = True).
Select(Function(q) New EmployeeListItem With
{
q.EID,
.Name = q.Lastname & ", " & q.Firstname
}).
OrderBy(Function(x) x.Name)
With cbxEmployee
.DisplayMember = "Name"
.ValueMember = "EID"
.DataSource = list
End With
Notice I never had to call ToList()
. This reduces memory use, and in some cases can make the code greatly more efficient.
Then, when using the value, you want to cast it, like this:
Dim EmployeeID As Integer = DirectCast(cbxEmployee.SelectedValue, EmployeeListItem).EID
edited Nov 20 '18 at 20:07
answered Nov 20 '18 at 19:59
Joel CoehoornJoel Coehoorn
309k95494728
309k95494728
I have tried to includeEmployeeListItem
to my expression and I got an error in theSelect
part
– kielou
Nov 20 '18 at 20:19
You have to define the class, too.
– Joel Coehoorn
Nov 20 '18 at 20:20
I already did define the class
– kielou
Nov 20 '18 at 20:25
I didn't solved my problem with this but because of this I gained some ideas how to solve and other problems too. Thank you so much for the explanation. I really appreciated it
– kielou
Nov 21 '18 at 3:10
add a comment |
I have tried to includeEmployeeListItem
to my expression and I got an error in theSelect
part
– kielou
Nov 20 '18 at 20:19
You have to define the class, too.
– Joel Coehoorn
Nov 20 '18 at 20:20
I already did define the class
– kielou
Nov 20 '18 at 20:25
I didn't solved my problem with this but because of this I gained some ideas how to solve and other problems too. Thank you so much for the explanation. I really appreciated it
– kielou
Nov 21 '18 at 3:10
I have tried to include
EmployeeListItem
to my expression and I got an error in the Select
part– kielou
Nov 20 '18 at 20:19
I have tried to include
EmployeeListItem
to my expression and I got an error in the Select
part– kielou
Nov 20 '18 at 20:19
You have to define the class, too.
– Joel Coehoorn
Nov 20 '18 at 20:20
You have to define the class, too.
– Joel Coehoorn
Nov 20 '18 at 20:20
I already did define the class
– kielou
Nov 20 '18 at 20:25
I already did define the class
– kielou
Nov 20 '18 at 20:25
I didn't solved my problem with this but because of this I gained some ideas how to solve and other problems too. Thank you so much for the explanation. I really appreciated it
– kielou
Nov 21 '18 at 3:10
I didn't solved my problem with this but because of this I gained some ideas how to solve and other problems too. Thank you so much for the explanation. I really appreciated it
– kielou
Nov 21 '18 at 3:10
add a comment |
Try turning Option Strict On. SelectedValue isn't an integer and can't be directly inserted in an integer. In this case, it is returning the object of the AnonymousType that you created. You would need decided .Name or .EID
I just tried to do your suggestion turning Option Strict On but it didn't work
– kielou
Nov 20 '18 at 19:39
@kielou Option Strict On won't fix the problem, it will help you see the errors. You still need to specify that you want the EID.
– the_lotus
Nov 20 '18 at 19:40
Oh. Sorry but how can I specify that I want the EID?
– kielou
Nov 20 '18 at 19:45
@kielou how you tried cbxEmployee.SelectedValue.EID ?
– the_lotus
Nov 20 '18 at 19:50
yes and it saysObject variable or With block variable not set
– kielou
Nov 20 '18 at 19:59
add a comment |
Try turning Option Strict On. SelectedValue isn't an integer and can't be directly inserted in an integer. In this case, it is returning the object of the AnonymousType that you created. You would need decided .Name or .EID
I just tried to do your suggestion turning Option Strict On but it didn't work
– kielou
Nov 20 '18 at 19:39
@kielou Option Strict On won't fix the problem, it will help you see the errors. You still need to specify that you want the EID.
– the_lotus
Nov 20 '18 at 19:40
Oh. Sorry but how can I specify that I want the EID?
– kielou
Nov 20 '18 at 19:45
@kielou how you tried cbxEmployee.SelectedValue.EID ?
– the_lotus
Nov 20 '18 at 19:50
yes and it saysObject variable or With block variable not set
– kielou
Nov 20 '18 at 19:59
add a comment |
Try turning Option Strict On. SelectedValue isn't an integer and can't be directly inserted in an integer. In this case, it is returning the object of the AnonymousType that you created. You would need decided .Name or .EID
Try turning Option Strict On. SelectedValue isn't an integer and can't be directly inserted in an integer. In this case, it is returning the object of the AnonymousType that you created. You would need decided .Name or .EID
answered Nov 20 '18 at 19:32
the_lotusthe_lotus
10.1k12246
10.1k12246
I just tried to do your suggestion turning Option Strict On but it didn't work
– kielou
Nov 20 '18 at 19:39
@kielou Option Strict On won't fix the problem, it will help you see the errors. You still need to specify that you want the EID.
– the_lotus
Nov 20 '18 at 19:40
Oh. Sorry but how can I specify that I want the EID?
– kielou
Nov 20 '18 at 19:45
@kielou how you tried cbxEmployee.SelectedValue.EID ?
– the_lotus
Nov 20 '18 at 19:50
yes and it saysObject variable or With block variable not set
– kielou
Nov 20 '18 at 19:59
add a comment |
I just tried to do your suggestion turning Option Strict On but it didn't work
– kielou
Nov 20 '18 at 19:39
@kielou Option Strict On won't fix the problem, it will help you see the errors. You still need to specify that you want the EID.
– the_lotus
Nov 20 '18 at 19:40
Oh. Sorry but how can I specify that I want the EID?
– kielou
Nov 20 '18 at 19:45
@kielou how you tried cbxEmployee.SelectedValue.EID ?
– the_lotus
Nov 20 '18 at 19:50
yes and it saysObject variable or With block variable not set
– kielou
Nov 20 '18 at 19:59
I just tried to do your suggestion turning Option Strict On but it didn't work
– kielou
Nov 20 '18 at 19:39
I just tried to do your suggestion turning Option Strict On but it didn't work
– kielou
Nov 20 '18 at 19:39
@kielou Option Strict On won't fix the problem, it will help you see the errors. You still need to specify that you want the EID.
– the_lotus
Nov 20 '18 at 19:40
@kielou Option Strict On won't fix the problem, it will help you see the errors. You still need to specify that you want the EID.
– the_lotus
Nov 20 '18 at 19:40
Oh. Sorry but how can I specify that I want the EID?
– kielou
Nov 20 '18 at 19:45
Oh. Sorry but how can I specify that I want the EID?
– kielou
Nov 20 '18 at 19:45
@kielou how you tried cbxEmployee.SelectedValue.EID ?
– the_lotus
Nov 20 '18 at 19:50
@kielou how you tried cbxEmployee.SelectedValue.EID ?
– the_lotus
Nov 20 '18 at 19:50
yes and it says
Object variable or With block variable not set
– kielou
Nov 20 '18 at 19:59
yes and it says
Object variable or With block variable not set
– kielou
Nov 20 '18 at 19:59
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53400163%2fwhy-i-cant-get-the-selected-value%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Why do you call
ToList
for the first expression? You could save yourself a bunch of memory by leaving that off.– Joel Coehoorn
Nov 20 '18 at 19:53