﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TourOfCSharp6
{
    public class Point
    {
        public double X { get; set; }
        public double Y { get; set; }
        public double Distance
        {
            get
            {
                return Math.Sqrt(X * X + Y * Y);
            }
        }
    }
}

﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TourOfCSharp6
{
    public class Point
    {
        public double X { get; set; }
        public double Y { get; set; }
        public double Distance => Math.Sqrt(X * X + Y * Y);
    }
}

Convert Distance to Expression Bodied Member
Convert Distance to Expression Bodied Member

This gives a simpler version of the class.
