T
tshad
I am trying to take part of my functions out of my Sort routine to do a
compare (as it does) where I just find out if object 1 is less then, equal
to or greater than object 2
I have the following:
ProjectTableName ptn1 = projectTables.Find(delegate(ProjectTableName ptn)
{return ptn.TableName == "employee";});
ProjectTableName ptn2 = projectTables.Find(delegate(ProjectTableName ptn)
{ return ptn.TableName == "customer"; });
int temp = delegate(ProjectTableName ptn1, ProjectTableName ptn2) {return
ptn1.ProcessOrder.CompareTo(ptn2);};
I am getting an error on the ptn1 and ptn2 in the last line that says:
A local variable named 'ptn1' cannot be declared in this scope because it
would give a different meaning to 'ptn1', which is already used in a 'parent
or current' scope to denote something else
The same for ptn2.
I am also getting an error:
Cannot convert anonymous method block to type 'int' because it is not a
delegate type
In the first 2 lines, I am trying to get a ProjectTableName object where the
TableName = "employee" and one that equals "customer".
Then I want to compare the objects using the ProcessOrder Property.
I want to eventually put the 2 Finds inside the last line to give me just
one line, but I was having similar problems so I tried to split it out first
just to get it to work.
How would I change this to make it work?
Thanks,
Tom
compare (as it does) where I just find out if object 1 is less then, equal
to or greater than object 2
I have the following:
ProjectTableName ptn1 = projectTables.Find(delegate(ProjectTableName ptn)
{return ptn.TableName == "employee";});
ProjectTableName ptn2 = projectTables.Find(delegate(ProjectTableName ptn)
{ return ptn.TableName == "customer"; });
int temp = delegate(ProjectTableName ptn1, ProjectTableName ptn2) {return
ptn1.ProcessOrder.CompareTo(ptn2);};
I am getting an error on the ptn1 and ptn2 in the last line that says:
A local variable named 'ptn1' cannot be declared in this scope because it
would give a different meaning to 'ptn1', which is already used in a 'parent
or current' scope to denote something else
The same for ptn2.
I am also getting an error:
Cannot convert anonymous method block to type 'int' because it is not a
delegate type
In the first 2 lines, I am trying to get a ProjectTableName object where the
TableName = "employee" and one that equals "customer".
Then I want to compare the objects using the ProcessOrder Property.
I want to eventually put the 2 Finds inside the last line to give me just
one line, but I was having similar problems so I tried to split it out first
just to get it to work.
How would I change this to make it work?
Thanks,
Tom