[Mono-dev] Possible problem with 2.0RC1
Zoltan Varga
vargaz at gmail.com
Wed Sep 17 19:06:41 EDT 2008
Hi,
Its not List<>.Add's fault. The ctor has the arguments in the wrong order:
public conversion(bool verb, bool plural, string form,
string german,
Zoltan
2008/9/18 Paul <paul at all-the-johnsons.co.uk>:
> Hi,
>
>> I have some very simple code which has become unpredictable.
>
> I've done some more tests and it looks like there may be a problem with
> when adding code to a list<>
>
> Changes to the previous code - if it was a bool, it's now a string (with
> alterations in other methods to reflect this)
>
>> private void splitline(string line)
>> {
>> string[] stringy = line.Split(new char[] {','});
>>
>> for (int m = 2; m < 6; ++m)
>> {
>> if (stringy[m] != "")
>> stringy[m] = remquotes(stringy[m]);
>> }
>>
>> // 1st column = plural (1 = yes) set as true if correct
>> // 2nd column = verb (1 = yes) set as true if correct
> if (stringy[0].Length > 1)
> Console.WriteLine("position {0}. Plural is > 1 character",
> counter);
> if (stringy[1].Length > 1)
> Console.WriteLine("position {1}. Verb is > 1 character",
> counter);
>
>> words.Add(new conversion((stringy[0] == "1" ? true : false),
>> (stringy[1] == "1" ? true : false),
>
> The test has gone and these become just stringy[0], stringy[1]
>
>> stringy[2], stringy[3], stringy[4],
>> stringy[5], stringy[6]));
>>
>> if (stringy[1] == "1")
>> {
>> Console.WriteLine("word {0}, is a verb", stringy[3]);
>> }
>> }
>
> The potential problem of an incorrect assignment being made to isplural
> or isverb has now gone. When I run the application, it's fine but still
> comes up with the same problem of a noun suddenly becoming a verb. The
> only way this can happen is if there is something up with the list<>.Add
> method.
>
> Full source (with binaries and test file)
>
> http://www.all-the-johnsons.co.uk/csharp/proto.tar.bz2
>
> If anyone can have a look to see if I've messed up or if it is
> list<>.Add at fault, I'd appreciate it.
>
> TTFN
>
> Paul
> --
> Sie können mich aufreizen und wirklich heiß machen!
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>
More information about the Mono-devel-list
mailing list