Tagged Questions
0
votes
0answers
16 views
Adding IEnumerable<T> items to IEnumerable<T>
I have the following:
foreach (var item in selected)
{
var categories = _repo.GetAllDCategories(item);
var result = from cat in categories
select
new
...
0
votes
1answer
48 views
Observable.Create doesn't work and Observable.ToEnumerable blocks indefinitely
Why the code below doesn't work?
var observable = Observable.Create<int>(o => new Action(() =>
{
o.OnNext(0);
o.OnCompleted();
}));
foreach (var item in ...
2
votes
2answers
121 views
LINQ filtering in IEnumerable property breaks binding
I have a TextBlock in my UI bound to the .Count() extension of a property. I would like to add LINQ filtering to the property, but when I do it breaks the binding.
This works and updates the UI ...
-1
votes
1answer
47 views
Having issue with select statement [closed]
I have this method
public CreateModule GetModuleDetails(long id)
{
var module = (_dbSis.Modules.Where(t => t.Id == id).Select(m => new CreateModule
{
Id = id,
ModuleId = ...
1
vote
1answer
32 views
Avoiding Redundancy using LINQ Enumerable All
I often feel that the IEnumerable<T>.All method is redundant when your T is a boolean array.
Given the following sample code, is there a better way to validate to use the All method
bool ...
0
votes
1answer
29 views
Can't get IEnumerable type using linq filtered query
i have been finding problems related to the following code..Actually i want to select filtered records but it gives me 0 records. I have tried the following. Please Help me..
public static ...
0
votes
1answer
50 views
Cannot convert IQueryable<IEnumerable<string>> to return type IEnumerable<string>
In the following function I get an error when I try to return a value saying:
Cannot convert
System.Linq.IQueryable<System.Collections.Generic.IEnumerable<string>>
to return type ...
2
votes
3answers
83 views
Count an IOrderedEnumerable without consuming it
What I want to do, short version:
var source = new[]{2,4,6,1,9}.OrderBy(x=>x);
int count = source.Count; // <-- get the number of elements without performing the sort
Long version:
To ...
0
votes
2answers
27 views
Applying child collections to matching parents in the parent collection
I have a method which will map the child collections to appropriate parents in the parent collection
public static void ApplyParentChild<TParent, TChild, TId>(
this ...
0
votes
1answer
38 views
Linq query to get filtred main collection and each list in result in that collection
These are my classes:
public class Restaurant
{
[Key]
public int Id { get; set; }
public string Name { get; set; }
public City City { get; set; }
public List<Meal> Meals { ...
0
votes
1answer
75 views
What is the purpose of AsQueryable()?
Is the purpose of AsQueryable() just so you can pass around an IEnumerable to methods that might expect IQueryable, or is there a useful reason to represent IEnumerable as IQueryable? For example, is ...
0
votes
2answers
52 views
Why does Linq.Enumerable.Where break my ObservableCollection
Background:
I am writing a WPF application, strictly following the MVVM pattern. I have a BaseRepository class as a generic interface for connecting to different databases (EF is not an option), and ...
2
votes
2answers
77 views
IEnumerable<string> to Dictionary<char, IEnumerable<string>>
I suppose that this question might partially duplicate other similar questions, but i'm having troubles with such a situation:
I want to extract from some string sentences
For example from
...
3
votes
2answers
65 views
How to create IEnumerable.ToString
If I have an IEnumerable, is this my cleanest way to create a ToString method that spits out the values comma delimited?
var enumOfObjects = myEnumerable as IList<object> ?? ...
-3
votes
2answers
77 views
Show all null fields in a IEnumerable query
I have the following (easy) table:
Table: MyDataTable
**Color**
Blue
null
Red
Yellow
null
null
Green
This query (for example):
query =
from user in MyDataTable.AsEnumerable()
where ...