Я использую monodevelop, и ссылаюсь на эту статью здесь http://docs.xamarin.com/android/tutorials/Maps_and_Location/Part_2_-_Maps_API#Adding_Overlays_to_a_Map, я пытаюсь создать наложения для карты. я думаю, что следовал 100% того, что говорится в руководстве, но я получил эту ошибку
Non-invocable member 'System.Collectios.Generic.List<Android.GoogleMaps.OverlayItem>.Count' cannot be used like a method.
вот мой полный код. кстати, ошибка относится к 4-й последней строке, return _items.Count (); , Я не знаю, где я поступил неправильно, так как просто следую инструкциям
using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
using Android.Util;
using Android.GoogleMaps;
using System.Collections.Generic;
using Android.Graphics;
using Android.Graphics.Drawables;
namespace HelloM4A
{
[Activity (Label = "HelloM4A")]
public class Activity1 : MapActivity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
MyLocationOverlay _myLocationOverlay;
// Set our view from the "main" layout resource
SetContentView (Resource.Layout.MapLayout);
var map = FindViewById<MapView>(Resource.Id.map);
map.Clickable = true;
//map.Traffic = true;
map.Satellite = true;
map.SetBuiltInZoomControls (true);
map.Controller.SetZoom (10);
map.Controller.SetCenter (new GeoPoint ((int)(2.925088 * 1E6), (int)(101.657381 * 1E6)));
var aButton = FindViewById<Button> (Resource.Id.aButton);
aButton.Click += (sender, e) => {
_myLocationOverlay = new MyLocationOverlay (this, map);
map.Overlays.Add (_myLocationOverlay);
};
}
protected override bool IsRouteDisplayed {
get {
return false; }
}
}
class MonkeyItemizedOverlay: ItemizedOverlay
{
List<OverlayItem> _items;
public MonkeyItemizedOverlay (Drawable Icon) : base(Icon)
{
// populate some sample location data for the overlay items
_items = new List<OverlayItem>{
new OverlayItem (new GeoPoint ((int)40.741773E6,
(int)-74.004986E6), null, null),
new OverlayItem (new GeoPoint ((int)41.051696E6,
(int)-73.545667E6), null, null),
new OverlayItem (new GeoPoint ((int)41.311197E6,
(int)-72.902646E6), null, null)
};
BoundCenterBottom(Icon);
Populate();
}
protected override Java.Lang.Object CreateItem (int i)
{
var item = _items[i];
return item;
}
public override int Size ()
{
return _items.Count();
}
}
}