Possible Duplicate:
How to call user defined function in LINQ in my visual C# web service for my android application?
I am currently developing an application on Android that will make use of the user location. The database will keep all the user location by latitude and longitude. I know how to calculate the distance from two points and it is a bit complicated.
However, in my webservice written in visual C#, I can't write something like this:
from a in db.Location.Where(a => distanceBetweenTwoLocations(givenLat, givenLong, a.lat, a.longi)<500) select new {...}
because the linq wont let me call my own function. Can anyone suggest some way to achieve my goal? For simplicity, i want to find other users that is 500m around me. I have all the user locations in latitude and longitude in my database.