Reputation: 381
public class ListItemCollection<T> : IEnumerable<T>
where T : IHasLabel, IComparable<T>
{
Errors: Error CS0703: Inconsistent accessibility: constraint type ....IHasLabel' is less accessible than ....ListItemCollection' (CS0703)
public override void OnActivityCreated(Bundle savedInstanceState)
{
base.OnActivityCreated(savedInstanceState);
/*
var items = new string[] { "Rock","Country", "Dance" };
lst = View.FindViewById<ListView> (Resource.Id.lstGenres);
lst.Adapter = new ArrayAdapter<string>(Activity, Resource.Layout.textViewItems,Resource.Id.textviewItems, items);
//lst = View.FindViewById<ListView> (Resource.Id.lst_genre);
//lst.SetAdapter(new ArrayAdapter<String>(this.Activity, Resource.Layout.GenerFragment, items));
lst.ItemClick+= delegate(object sender, AdapterView.ItemClickEventArgs e) {};*/
var data = new ListItemCollection<ListItemValue> () {
new ListItemValue ("Babbage"),
new ListItemValue ("Boole"),
new ListItemValue ("Berners-Lee"),
new ListItemValue ("Atanasoff"),
new ListItemValue ("Allen"),
new ListItemValue ("Cormack"),
new ListItemValue ("Cray"),
new ListItemValue ("Dijkstra"),
new ListItemValue ("Dix"),
new ListItemValue ("Dewey"),
new ListItemValue ("Erdos"),
};
var sortedContacts = data.GetSortedData ();
var adapter = CreateAdapter (sortedContacts);
ListAdapter = adapter;
}
SeparatedListAdapter CreateAdapter<T> (Dictionary<string, List<T>> sortedObjects)
where T : IHasLabel, IComparable<T>
{
var adapter = new SeparatedListAdapter (this);
foreach (var e in sortedObjects.OrderBy (de => de.Key)) {
var label = e.Key;
var section = e.Value;
adapter.AddSection (label, new ArrayAdapter<T> (this, Resource.Layout.lstGenres, section));
}
return adapter;
}
ListAdapter = adapter;-> the name listadapter does not exist in the current context.
var adapter = new SeparatedListAdapter (this);-> the best overloaded method match for ....SeparatedListAdapter(android.content.context) has some invalid arguments
Upvotes: 0
Views: 64
Reputation: 4343
Just looked it up, someone forgot to add public...
namespace TablesAndCellStyles
{
interface IHasLabel
{
string Label {get;}
}
}
Not quite sure what your question is, use your own IHasLabel interface.
Upvotes: 0