Use expression bodies for properties

This commit is contained in:
Clemens 2022-08-06 11:04:49 +02:00
parent 74ba508e26
commit 209833561e
6 changed files with 19 additions and 29 deletions

View file

@ -12,20 +12,15 @@ namespace MapControl.Caching
{
public partial class FileDbCache : ObjectCache
{
public override string Name
{
get { return string.Empty; }
}
public override string Name => string.Empty;
public override DefaultCacheCapabilities DefaultCacheCapabilities
{
get { return DefaultCacheCapabilities.AbsoluteExpirations | DefaultCacheCapabilities.SlidingExpirations; }
}
public override DefaultCacheCapabilities DefaultCacheCapabilities =>
DefaultCacheCapabilities.AbsoluteExpirations | DefaultCacheCapabilities.SlidingExpirations;
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

@ -34,8 +34,8 @@ namespace MapControl.MBTiles
public string File
{
get { return (string)GetValue(FileProperty); }
set { SetValue(FileProperty, value); }
get => (string)GetValue(FileProperty);
set => SetValue(FileProperty, value);
}
/// <summary>

View file

@ -44,8 +44,8 @@ namespace MapControl.Projections
/// </summary>
public string CoordinateSystemWkt
{
get { return CoordinateSystem?.WKT; }
protected set { CoordinateSystem = new CoordinateSystemFactory().CreateFromWkt(value); }
get => CoordinateSystem?.WKT;
protected set => CoordinateSystem = new CoordinateSystemFactory().CreateFromWkt(value);
}
/// <summary>
@ -53,7 +53,7 @@ namespace MapControl.Projections
/// </summary>
public ICoordinateSystem CoordinateSystem
{
get { return coordinateSystem; }
get => coordinateSystem;
protected set
{
coordinateSystem = value ?? throw new ArgumentNullException(nameof(value));

View file

@ -51,8 +51,8 @@ namespace MapControl.UiTools
public MapBase Map
{
get { return (MapBase)GetValue(MapProperty); }
set { SetValue(MapProperty, value); }
get => (MapBase)GetValue(MapProperty);
set => SetValue(MapProperty, value);
}
public Collection<MapLayerItem> MapLayers { get; } = new ObservableCollection<MapLayerItem>();

View file

@ -50,8 +50,8 @@ namespace MapControl.UiTools
public MapBase Map
{
get { return (MapBase)GetValue(MapProperty); }
set { SetValue(MapProperty, value); }
get => (MapBase)GetValue(MapProperty);
set => SetValue(MapProperty, value);
}
public Collection<MapProjectionItem> MapProjections { get; } = new ObservableCollection<MapProjectionItem>();

View file

@ -13,20 +13,15 @@ namespace MapControl.Caching
{
public partial class SQLiteCache : ObjectCache
{
public override string Name
{
get { return string.Empty; }
}
public override string Name => string.Empty;
public override DefaultCacheCapabilities DefaultCacheCapabilities
{
get { return DefaultCacheCapabilities.AbsoluteExpirations | DefaultCacheCapabilities.SlidingExpirations; }
}
public override DefaultCacheCapabilities DefaultCacheCapabilities =>
DefaultCacheCapabilities.AbsoluteExpirations | DefaultCacheCapabilities.SlidingExpirations;
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()