IEnumerable Queue.Count is not returning an integer [closed]
I am attempting to define a queue named movingAverages with a size of queue.Count - period. I am getting an error "int IEnumerable.Count() ... - cannot be applied to method and int....
private static IEnumerable<DateClose> MovingAverage(
IEnumerable<DateClose> queue, int period)
{
Queue<DateClose> movingAverages = new Queue<DateClose>(queue.Count + period);
return movingAverages;
}
c#
closed as off-topic by Progman, Christian Gollhardt, Erik Philips, BJ Myers, Graham Nov 16 '18 at 0:40
This question appears to be off-topic. The users who voted to close gave these specific reasons:
- "This question was caused by a problem that can no longer be reproduced or a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers. This can often be avoided by identifying and closely inspecting the shortest program necessary to reproduce the problem before posting." – Erik Philips, BJ Myers, Graham
- "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – Progman, Christian Gollhardt
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
I am attempting to define a queue named movingAverages with a size of queue.Count - period. I am getting an error "int IEnumerable.Count() ... - cannot be applied to method and int....
private static IEnumerable<DateClose> MovingAverage(
IEnumerable<DateClose> queue, int period)
{
Queue<DateClose> movingAverages = new Queue<DateClose>(queue.Count + period);
return movingAverages;
}
c#
closed as off-topic by Progman, Christian Gollhardt, Erik Philips, BJ Myers, Graham Nov 16 '18 at 0:40
This question appears to be off-topic. The users who voted to close gave these specific reasons:
- "This question was caused by a problem that can no longer be reproduced or a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers. This can often be avoided by identifying and closely inspecting the shortest program necessary to reproduce the problem before posting." – Erik Philips, BJ Myers, Graham
- "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – Progman, Christian Gollhardt
If this question can be reworded to fit the rules in the help center, please edit the question.
Please edit your question to include the full source code and the full error message.
– Progman
Nov 15 '18 at 22:17
.Count() is a method, not a property. You need the parenthesis. Otherwise you're attempting to add the method to an integer.
– Glorin Oakenfoot
Nov 15 '18 at 22:26
add a comment |
I am attempting to define a queue named movingAverages with a size of queue.Count - period. I am getting an error "int IEnumerable.Count() ... - cannot be applied to method and int....
private static IEnumerable<DateClose> MovingAverage(
IEnumerable<DateClose> queue, int period)
{
Queue<DateClose> movingAverages = new Queue<DateClose>(queue.Count + period);
return movingAverages;
}
c#
I am attempting to define a queue named movingAverages with a size of queue.Count - period. I am getting an error "int IEnumerable.Count() ... - cannot be applied to method and int....
private static IEnumerable<DateClose> MovingAverage(
IEnumerable<DateClose> queue, int period)
{
Queue<DateClose> movingAverages = new Queue<DateClose>(queue.Count + period);
return movingAverages;
}
c#
c#
asked Nov 15 '18 at 22:15
Jam66125Jam66125
596
596
closed as off-topic by Progman, Christian Gollhardt, Erik Philips, BJ Myers, Graham Nov 16 '18 at 0:40
This question appears to be off-topic. The users who voted to close gave these specific reasons:
- "This question was caused by a problem that can no longer be reproduced or a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers. This can often be avoided by identifying and closely inspecting the shortest program necessary to reproduce the problem before posting." – Erik Philips, BJ Myers, Graham
- "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – Progman, Christian Gollhardt
If this question can be reworded to fit the rules in the help center, please edit the question.
closed as off-topic by Progman, Christian Gollhardt, Erik Philips, BJ Myers, Graham Nov 16 '18 at 0:40
This question appears to be off-topic. The users who voted to close gave these specific reasons:
- "This question was caused by a problem that can no longer be reproduced or a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers. This can often be avoided by identifying and closely inspecting the shortest program necessary to reproduce the problem before posting." – Erik Philips, BJ Myers, Graham
- "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – Progman, Christian Gollhardt
If this question can be reworded to fit the rules in the help center, please edit the question.
Please edit your question to include the full source code and the full error message.
– Progman
Nov 15 '18 at 22:17
.Count() is a method, not a property. You need the parenthesis. Otherwise you're attempting to add the method to an integer.
– Glorin Oakenfoot
Nov 15 '18 at 22:26
add a comment |
Please edit your question to include the full source code and the full error message.
– Progman
Nov 15 '18 at 22:17
.Count() is a method, not a property. You need the parenthesis. Otherwise you're attempting to add the method to an integer.
– Glorin Oakenfoot
Nov 15 '18 at 22:26
Please edit your question to include the full source code and the full error message.
– Progman
Nov 15 '18 at 22:17
Please edit your question to include the full source code and the full error message.
– Progman
Nov 15 '18 at 22:17
.Count() is a method, not a property. You need the parenthesis. Otherwise you're attempting to add the method to an integer.
– Glorin Oakenfoot
Nov 15 '18 at 22:26
.Count() is a method, not a property. You need the parenthesis. Otherwise you're attempting to add the method to an integer.
– Glorin Oakenfoot
Nov 15 '18 at 22:26
add a comment |
1 Answer
1
active
oldest
votes
Well it's because IEnumerable<T>.Count
is a method, so you are missing the parentheses at queue.Count + period
, which should be queue.Count() + period
.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Well it's because IEnumerable<T>.Count
is a method, so you are missing the parentheses at queue.Count + period
, which should be queue.Count() + period
.
add a comment |
Well it's because IEnumerable<T>.Count
is a method, so you are missing the parentheses at queue.Count + period
, which should be queue.Count() + period
.
add a comment |
Well it's because IEnumerable<T>.Count
is a method, so you are missing the parentheses at queue.Count + period
, which should be queue.Count() + period
.
Well it's because IEnumerable<T>.Count
is a method, so you are missing the parentheses at queue.Count + period
, which should be queue.Count() + period
.
answered Nov 15 '18 at 22:28
MadKarelMadKarel
812
812
add a comment |
add a comment |
Please edit your question to include the full source code and the full error message.
– Progman
Nov 15 '18 at 22:17
.Count() is a method, not a property. You need the parenthesis. Otherwise you're attempting to add the method to an integer.
– Glorin Oakenfoot
Nov 15 '18 at 22:26