strange if using statement, cant reach return path?

HalukYILMAZHalukYILMAZ USMember
     public IEnumerable<RequestCall> GetRequests(string erisim, string sube, string sicil)
        {
            using (var redisclient = RedisManager.GetClient())
            {
                var redisUser = redisclient.As<RequestCall>();

                if (erisim == "A")
                {
                    return redisUser.GetAll();// .Where(c=>c.Sube=="Y");
                }
                else if (erisim == "P")
                {
                    return redisUser.GetAll().Where(c => c.Sube == sube);
                }
                else if (erisim == "C")
                {
                    return redisUser.GetAll().Where(c => c.CagriAcan == sicil);
                }

            }
        }

i cant reach return , is there any other way? thanks

Posts

  • DaveHuntDaveHunt USMember ✭✭✭✭✭

    As your code is written, if erisim is not "A", "P" or "C", then you don't return anything. If those are the only valid values for erisim, then add an else clause that throws an exception or returns null.

Sign In or Register to comment.