I am kinda new to Xamarin.Android and still have a steep learning curve ;-). But i approached a problem which i don't find a solution even after a few days of googling and YouTube-ing.
Do somebody know how to call a async Task from another Class?
i want to call the public async Task ReadStringAsync() from the class MainActivity. How can i do that?
i want to call this:
class TextfileRead
{
string[] StrData;
String filename = "Arbeitszeiten.txt";
String filepath = "myFileDir";
String fileContent = "";
public async Task<string> ReadStringAsync()
{
var backingFile = Path.Combine(filepath, filename);
if (backingFile == null || !System.IO.File.Exists(backingFile))
{
return "oO, irgendwas ging schief";
}
string line;
using (var reader = new StreamReader(backingFile, true))
{
//string line;
while ((line = await reader.ReadLineAsync()) != null)
{
//return line;
}
}
return line;
}
question from:
https://stackoverflow.com/questions/65939662/c-sharp-call-interclass-asynch-task 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…