ServiceStack.Redis.RedisNativeClient.GeoRadius C# (CSharp) Method

GeoRadius() public method

public GeoRadius ( string key, double longitude, double latitude, double radius, string unit, bool withCoords = false, bool withDist = false, bool withHash = false, int count = null, bool asc = null ) : List
key string
longitude double
latitude double
radius double
unit string
withCoords bool
withDist bool
withHash bool
count int
asc bool
return List
        public List<RedisGeoResult> GeoRadius(string key, double longitude, double latitude, double radius, string unit,
            bool withCoords = false, bool withDist = false, bool withHash = false, int? count = null, bool? asc = null)
        {
            if (key == null)
                throw new ArgumentNullException("key");

            var args = new List<byte[]>
            {
                longitude.ToUtf8Bytes(),
                latitude.ToUtf8Bytes(),
                radius.ToUtf8Bytes(),
                Commands.GetUnit(unit),
            };

            if (withCoords)
                args.Add(Commands.WithCoord);
            if (withDist)
                args.Add(Commands.WithDist);
            if (withHash)
                args.Add(Commands.WithHash);

            if (count != null)
            {
                args.Add(Commands.Count);
                args.Add(count.Value.ToUtf8Bytes());
            }

            if (asc == true)
                args.Add(Commands.Asc);
            else if (asc == false)
                args.Add(Commands.Desc);

            var cmdWithArgs = MergeCommandWithArgs(Commands.GeoRadius, key.ToUtf8Bytes(), args.ToArray());

            var to = new List<RedisGeoResult>();

            if (!(withCoords || withDist || withHash))
            {
                var members = SendExpectMultiData(cmdWithArgs).ToStringArray();
                foreach (var member in members)
                {
                    to.Add(new RedisGeoResult { Member = member });
                }
            }
            else
            {
                var data = SendExpectComplexResponse(cmdWithArgs);

                foreach (var child in data.Children)
                {
                    var i = 0;
                    var result = new RedisGeoResult { Unit = unit, Member = child.Children[i++].Data.FromUtf8Bytes() };

                    if (withDist)
                        result.Distance = double.Parse(child.Children[i++].Data.FromUtf8Bytes());

                    if (withHash)
                        result.Hash = long.Parse(child.Children[i++].Data.FromUtf8Bytes());

                    if (withCoords)
                    {
                        result.Longitude = double.Parse(child.Children[i].Children[0].Data.FromUtf8Bytes());
                        result.Latitude = double.Parse(child.Children[i].Children[1].Data.FromUtf8Bytes());
                    }

                    to.Add(result);
                }
            }

            return to;
        }
RedisNativeClient