i building windows grid app (vb 2012 c#) , trying edit information in sampledatasource.cs. have lot of information add , wanted read in information .txt file instead of using string.format() every time. got far not working, keeps giving me error "sampledatasource': member names cannot same enclosing type". worried change name of class auto-generated code. how can read in contents fromm .txt file?
public static string item_content = ""; public static async task readtextfilecontents(string filelocation) { var file = await package.current.installedlocation.getfileasync(filelocation); var result = await fileio.readtextasync(file); item_content = result.tostring(); } public async task sampledatasource() { await readtextfilecontents("text_files/warmup_description.txt"); var group1 = new sampledatagroup("group-1", "warmup", "group subtitle: 1", "assets/darkgray.png", item_content);
your part wrong..
public async task sampledatasource() { await readtextfilecontents("text_files/warmup_description.txt"); var group1 = new sampledatagroup("group-1", "warmup", "group subtitle: 1", "assets/darkgray.png", item_content);
you can add return type constructor can read file in other method..
Comments
Post a Comment