![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
i don't know whether you can answer to questions about issues in 3.5, but i'll ask anyway. i have this code: var material = from materials in myDC.Materials where materials.Name == materialName select materials; it is supposed to load 1 object. how do i know if "material" is loaded or is null or smth like this? or should i use foreach every time? because in this case, material is IQueriable<Material>. |
#3
| |||
| |||
|
|
dan <d@d.d> wrote: i don't know whether you can answer to questions about issues in 3.5, but i'll ask anyway. i have this code: var material = from materials in myDC.Materials where materials.Name == materialName select materials; it is supposed to load 1 object. how do i know if "material" is loaded or is null or smth like this? or should i use foreach every time? because in this case, material is IQueriable<Material>. Options are: FirstOrDefault() - there might be 0 or 1 matches First() - there might be more than one match, just use the first Single() - there should be exactly one match, throw otherwise |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |