I has some method, for example:
public VAR GetAllPosts()
{
var post = from p in _db.Posts select p;
return post;
}
How return var-type variable?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Based on your code, you know it’s going to be a enumeration of Posts, so return
or
If you want to go hardcore you could use something like this, this is a generic type of T, you have to call the method with the desired type and inside it validate the type and do what you like.
To call this method you pass the correct type
Hope it helps.