A namespace cannot directly contain members?
24,660
your code needs to be contained within a Class
namespace freesongsforme
{
public class MyClass {
static void Main(string[] args)
{
var listView = new ListView();
var myTrainers = new ObservableCollection<string>() {
"Song 1",
"Song 2",
};
listView.ItemsSource = mySongs;
myTrainers.Add("Songsr");
}
}
Author by
Admin
Updated on August 16, 2022Comments
-
Admin over 1 year
I have a problem. I have been following a tutorial, so that I could learn programming with Xamarin. Well now I have this error line, that I have written in the title. Here's the code for you all;
using System.Collections.ObjectModel; using UIKit; namespace freesongsforme { static void Main(string[] args) { var listView = new ListView(); var myTrainers = new ObservableCollection<string>() { "Song 1", "Song 2", }; listView.ItemsSource = mySongs; myTrainers.Add("Songsr"); }
The ''main'' part is marked as an error.