Use expression bodies for properties

This commit is contained in:
Clemens 2022-08-06 10:40:59 +02:00
parent e8b37f03ff
commit 74ba508e26
33 changed files with 194 additions and 230 deletions

View file

@ -21,20 +21,14 @@ namespace MapControl.Caching
private readonly MemoryCache memoryCache = MemoryCache.Default;
public override string Name
{
get { return string.Empty; }
}
public override string Name => string.Empty;
public override DefaultCacheCapabilities DefaultCacheCapabilities
{
get { return DefaultCacheCapabilities.None; }
}
public override DefaultCacheCapabilities DefaultCacheCapabilities => DefaultCacheCapabilities.None;
public override object this[string key]
{
get { return Get(key); }
set { Set(key, value, null); }
get => Get(key);
set => Set(key, value, null);
}
protected override IEnumerator<KeyValuePair<string, object>> GetEnumerator()

View file

@ -42,8 +42,8 @@ namespace MapControl
/// </summary>
public double MouseWheelZoomDelta
{
get { return (double)GetValue(MouseWheelZoomDeltaProperty); }
set { SetValue(MouseWheelZoomDeltaProperty, value); }
get => (double)GetValue(MouseWheelZoomDeltaProperty);
set => SetValue(MouseWheelZoomDeltaProperty, value);
}
/// <summary>
@ -51,8 +51,8 @@ namespace MapControl
/// </summary>
public ManipulationModes ManipulationMode
{
get { return (ManipulationModes)GetValue(ManipulationModeProperty); }
set { SetValue(ManipulationModeProperty, value); }
get => (ManipulationModes)GetValue(ManipulationModeProperty);
set => SetValue(ManipulationModeProperty, value);
}
private void OnManipulationStarted(object sender, ManipulationStartedEventArgs e)

View file

@ -26,8 +26,8 @@ namespace MapControl
/// </summary>
public bool AutoCollapse
{
get { return (bool)GetValue(AutoCollapseProperty); }
set { SetValue(AutoCollapseProperty, value); }
get => (bool)GetValue(AutoCollapseProperty);
set => SetValue(AutoCollapseProperty, value);
}
/// <summary>
@ -35,8 +35,8 @@ namespace MapControl
/// </summary>
public Location Location
{
get { return (Location)GetValue(LocationProperty); }
set { SetValue(LocationProperty, value); }
get => (Location)GetValue(LocationProperty);
set => SetValue(LocationProperty, value);
}
}
@ -55,8 +55,8 @@ namespace MapControl
public CornerRadius CornerRadius
{
get { return (CornerRadius)GetValue(CornerRadiusProperty); }
set { SetValue(CornerRadiusProperty, value); }
get => (CornerRadius)GetValue(CornerRadiusProperty);
set => SetValue(CornerRadiusProperty, value);
}
}
}

View file

@ -25,8 +25,8 @@ namespace MapControl
public IEnumerable<IMapDrawingItem> ItemsSource
{
get { return (IEnumerable<IMapDrawingItem>)GetValue(ItemsSourceProperty); }
set { SetValue(ItemsSourceProperty, value); }
get => (IEnumerable<IMapDrawingItem>)GetValue(ItemsSourceProperty);
set => SetValue(ItemsSourceProperty, value);
}
protected override async Task<ImageSource> GetImageAsync(IProgress<double> progress)

View file

@ -27,8 +27,8 @@ namespace MapControl
/// </summary>
public IEnumerable<IEnumerable<Location>> Polygons
{
get { return (IEnumerable<IEnumerable<Location>>)GetValue(PolygonsProperty); }
set { SetValue(PolygonsProperty, value); }
get => (IEnumerable<IEnumerable<Location>>)GetValue(PolygonsProperty);
set => SetValue(PolygonsProperty, value);
}
public MapMultiPolygon()

View file

@ -18,14 +18,11 @@ namespace MapControl
public Geometry Data
{
get { return (Geometry)GetValue(DataProperty); }
set { SetValue(DataProperty, value); }
get => (Geometry)GetValue(DataProperty);
set => SetValue(DataProperty, value);
}
protected override Geometry DefiningGeometry
{
get { return Data; }
}
protected override Geometry DefiningGeometry => Data;
#region Methods used only by derived classes MapPolyline, MapPolygon and MapMultiPolygon

View file

@ -43,26 +43,26 @@ namespace MapControl
public Brush Background
{
get { return (Brush)GetValue(BackgroundProperty); }
set { SetValue(BackgroundProperty, value); }
get => (Brush)GetValue(BackgroundProperty);
set => SetValue(BackgroundProperty, value);
}
public Brush BorderBrush
{
get { return (Brush)GetValue(BorderBrushProperty); }
set { SetValue(BorderBrushProperty, value); }
get => (Brush)GetValue(BorderBrushProperty);
set => SetValue(BorderBrushProperty, value);
}
public CornerRadius CornerRadius
{
get { return (CornerRadius)GetValue(CornerRadiusProperty); }
set { SetValue(CornerRadiusProperty, value); }
get => (CornerRadius)GetValue(CornerRadiusProperty);
set => SetValue(CornerRadiusProperty, value);
}
public Thickness Padding
{
get { return (Thickness)GetValue(PaddingProperty); }
set { SetValue(PaddingProperty, value); }
get => (Thickness)GetValue(PaddingProperty);
set => SetValue(PaddingProperty, value);
}
protected override Size MeasureOverride(Size constraint)

View file

@ -14,10 +14,8 @@ namespace MapControl
/// <summary>
/// Default folder path where an ObjectCache instance may save cached data, i.e. C:\ProgramData\MapControl\TileCache
/// </summary>
public static string DefaultCacheFolder
{
get { return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MapControl", "TileCache"); }
}
public static string DefaultCacheFolder =>
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MapControl", "TileCache");
/// <summary>
/// An ObjectCache instance used to cache tile image data. The default value is MemoryCache.Default.