using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using Windows.Devices.Geolocation;
namespace Project
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class Geolocation : Page
{
public Geolocation()
{
this.InitializeComponent();
}
public async void GetCords()
{
Geolocator locator = new Geolocator();
Geoposition pos = await locator.GetGeopositionAsync();
await new Windows.UI.Popups.MessageDialog(pos.CivicAddress.City).ShowAsync();
}
}
}
下的任何类型的集合是否都不会继承System.Collections
或IEnumerable
?
我需要一个例子。
答案 0 :(得分:4)
System.Collections
中没有类直接将实现IEnumerable<T>
- 该命名空间早于.NET中的泛型 - 但是可以大致定义的类&#34;集合&#34 ;在该命名空间中,所有实现IEnumerable
如果我们扩展到&#34; System.Collections
&#34;以下的任何命名空间我们进入System.Collections.Generic
和System.Collections.ObjectModel
以及System.Collections.Specialized
- 其中的所有集合类都实现了IEnumerable
,IEnumerable<T>
或两者。