M# Tutorials

Learn to build .NET applications with M#. Our step-by-step tutorials will get you up-to-speed rapidly.
If you already know ASP.NET and C#, you can master M# in a week or two.

IGeoLocation & IGeoLocated

This tutorial focuses on two important interfaces defined in M# framework to calculate geo location. We often need to display geo location related features on our websites e.g. showing search results of properties in within 2Km distance of a postcode. We use latitude and longitude properties of a given address to calculate distances between two locations, which requires complex mathematical calculations. This tutorial explains M# framework interfaces and classes implemented to manipulate geo location information.

IGeoLocation Interface

This interface provided under “MSharp.Framework.Services” namespace and defines on two basic properties required to maintain geo location i.e. Latitude and Longitude

IGeoLocated Interface

This interface is also provided under “MSharp.Framework.Services” namespace and only contains definition of one method “GetLocation()”. This method returns an “IGeoLocation” type object, which we discussed above.

Geo Location Extensions

M# framework exposes extension methods on the interface explained above to perform distance calculation. An object of “Double?” is returned which contains the distance between provided geo locations. Below are the definitions with description of each extension method: