C
C#2y ago
morry329#

✅ Two symbols not resolved

I have two errors saying "symbol not resolved" on my code. All the methods here are inside of the same class. I tried to initialize a variable from the Class but it did not work. Could anyone kindly point me out a correct direction (like links to tutorials/videos or just a little bit of advice)?
public static Hashtable Solution
{
get
{
return _solution;
}

private set
{
_solution = value;
}
}

public void AddItem(string attribute, string classification, string column)
{
column = ActivateReader(@"/.csv").ToString();
var key = Convert.ToString(attribute + Convert.ToString("->")) + classification; //irgendwo hier soll csv datei abgelesen werden

Finder item = null;
if (Items.ContainsKey(key))
;

if (item == null)
{
item = new Finder(attribute, classification, column);

}
}

public void Build(TextReader r)
{
foreach (string head in header)
{
list.Add(new Solution(head)); //ERROR "Symbol Solution not resolved"
}

string line = r.ReadLine();

while (line != null)
{
var tokens = line.Split(new char[] { ';' });

string classfication = tokens[0];

for (int i = 1; i <= tokens.Length - 1; i++)
{
Finder add = new Finder();
string attribute = tokens[i];


list[i].AddItem(attribute, classfication, ""); //ERROR "Symbol AddItem not resolved"
}
line = r.ReadLine();
}
r.Close();

}
public static Hashtable Solution
{
get
{
return _solution;
}

private set
{
_solution = value;
}
}

public void AddItem(string attribute, string classification, string column)
{
column = ActivateReader(@"/.csv").ToString();
var key = Convert.ToString(attribute + Convert.ToString("->")) + classification; //irgendwo hier soll csv datei abgelesen werden

Finder item = null;
if (Items.ContainsKey(key))
;

if (item == null)
{
item = new Finder(attribute, classification, column);

}
}

public void Build(TextReader r)
{
foreach (string head in header)
{
list.Add(new Solution(head)); //ERROR "Symbol Solution not resolved"
}

string line = r.ReadLine();

while (line != null)
{
var tokens = line.Split(new char[] { ';' });

string classfication = tokens[0];

for (int i = 1; i <= tokens.Length - 1; i++)
{
Finder add = new Finder();
string attribute = tokens[i];


list[i].AddItem(attribute, classfication, ""); //ERROR "Symbol AddItem not resolved"
}
line = r.ReadLine();
}
r.Close();

}
7 Replies
Angius
Angius2y ago
Why are you using HashTable...? Also, do you have a class named Solution?
morry329#
morry329#OP2y ago
The Hashtable came from the book that I practice code with. No, I only have the data named
Solution
Solution
, this one:
public static Hashtable Solution
{
get
{
return _solution;
}

private set
{
_solution = value;
}
}
public static Hashtable Solution
{
get
{
return _solution;
}

private set
{
_solution = value;
}
}
`
Angius
Angius2y ago
Just so you know, hashtable hasn't been in use for for probably well over a decade now Dictionary<TKey, TValue> is what you use So if it came from a book, the book is probably too old to be of any use
morry329#
morry329#OP2y ago
Ahhhhhh Thank you so much for pointing that out The book was first published in 2018, but seems to me like I am working with the deprecated reference I did not know Hashtable hasn't been in use for such a long time
Angius
Angius2y ago
Here you can find a bit more about non-generic and generic collections and why you shouldn't be using the former: https://youtu.be/egPvSkPwDN4?t=2107
morry329#
morry329#OP2y ago
Thanks a lot for the link, will check it out tomorrow 😉
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server