I have a method that will take data from a DB and I would like to return a single object back.
However the following code will return null back.
I already verified that the dt coming in contains 1 record.
This method works if I change the return type from an object to a list of objects.
I am tying to understand why in this case and why I can't return just a single object.
    public PersonObj GetPersonInformation(string personName)
    {
        DataTable dt = _oracle.GetPersonInformation(personName);
        var aPerson = dt.AsEnumerable().Select(x => 
                    new PersonObj
                    {
                        FirstName = x.Field<string>("FIRST_NAME"),
                        LastName = x.Field<string>("LAST_NAME"),
                        PhoneNumber = x.Field<string>("PHONE_NUMBER")
                    }).ToList().Take(1);
        return aPerson as PersonObj;
    }
 
     
     
    