473,379 Members | 1,184 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Cannot apply indexing with[] to an expression of type method group

Hello,

I´m getting the above error with following lines of code:

SortedList<int, intpreparedConcepts = prepareConcepts(docs);
IList<intpreparedKeys = preparedConcepts.Keys;
foreach (int key in preparedKeys)
{
int count = prepareConcepts[key];
if (minThreshold_ count || maxThreshold_ < count)
uselessConcepts_.Add(key);

}

but I cannot really find the error in my code.
It must be in line:
prepareConcepts[key];

In other ways it is possible to work with an index of int in a
SortedList. Why I´m getting this error here?
Regards,

Martin
Nov 16 '06 #1
2 12406
Martin,

You're trying to use an array accessor ([]) with a method,
prepareConcepts(). prepareConcepts returns an object of type group,
hence your error.

I would recommend this:

SortedList<int, intpreparedConcepts = prepareConcepts(docs);
foreach (KeyValuePair<int, intpairNext in preparedConcepts)
{
int count = pairNext.Value;
...
uselessConcepts_.Add(pairNext.Key);
}

That makes better use of SortedList functionality without a whole lot
of throwing around collections you don't need.

Short of that, fix your typo:

int count = prepareConcepts[key];

should be

int count = preparedConcepts[key];

Stephan

Martin Pöpping wrote:
Hello,

I´m getting the above error with following lines of code:

SortedList<int, intpreparedConcepts = prepareConcepts(docs);
IList<intpreparedKeys = preparedConcepts.Keys;
foreach (int key in preparedKeys)
{
int count = prepareConcepts[key];
if (minThreshold_ count || maxThreshold_ < count)
uselessConcepts_.Add(key);

}

but I cannot really find the error in my code.
It must be in line:
prepareConcepts[key];

In other ways it is possible to work with an index of int in a
SortedList. Why I´m getting this error here?
Regards,

Martin
Nov 16 '06 #2

Martin Pöpping wrote:
Hello,

I´m getting the above error with following lines of code:

SortedList<int, intpreparedConcepts = prepareConcepts(docs);
IList<intpreparedKeys = preparedConcepts.Keys;
foreach (int key in preparedKeys)
{
int count = prepareConcepts[key];
if (minThreshold_ count || maxThreshold_ < count)
uselessConcepts_.Add(key);

}

but I cannot really find the error in my code.
It must be in line:
prepareConcepts[key];

In other ways it is possible to work with an index of int in a
SortedList. Why I´m getting this error here?
It looks like you have a typo:

int count = prepareConcepts[key]

should be

int count = preparedConcepts[key]

You seem to have omitted the 'd' from preparedConcepts

Chris

Nov 16 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
8
by: Bassem | last post by:
Hi to all... Thanks for the help... I want to get the value of the column of dataset into array, but I get this bug. "Cannot apply indexing with to an expression of type 'object'" when biuld....
3
by: Karel Vandenhove | last post by:
Hi, I get an error "cannot apply indexing with to an expression of type object" when I try to compile the code below. SSLScannerManager is a COM component. (Used to access fingerprint...
3
by: klynn | last post by:
I defined a session variable as an array using Session = new string; Later, in my code, I need to set it and sort it. I tried Session = "some string"; My error is "Cannot apply indexing with to...
3
by: Adam J Knight | last post by:
Hi all, I am getting the following error with this if statement.. if(e.Item.DataItem != 2) { } //error Cannot apply indexing with to an expression of type 'object' Can someone fill me in on...
26
by: jacob navia | last post by:
Suppose an implementation where sizeof int == 4 sizeof void * == 8 sizeof long long == 8 When indexing an array array this would mean that arrays are limited to 2GB. To overcome this,
4
by: O.B. | last post by:
I have the following: public class Matrix3D { private const int SIZE = 3; public double matrix = new double; public static Matrix3D operator *(Matrix3D lhs, Matrix3D rhs) { Matrix3D result...
4
by: Chiefy | last post by:
C# APP Basically i am trying to use indexing on an array that i have fed into a method as its parameter. Here is a simplified version of my code. public void Inputs(string path) { ...
4
by: fabian.lim | last post by:
Hi All, Im a newbie to C++, I am trying to customize the vector template STL to a template Class. My code is shown below. Im confused about something and maybe somebody here might be able to...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.