My limited knowledge concerning programming entails that in order to use a non-static method, you need to first create an instance of the class. In order to use static methods, you simply use the Class name with the method name. I'm doing the WebPages tutorials for on asp.net and I came across the following code which confused me:
@{
var title = "";
var genre = "";
var year = "";
if(IsPost){
title = Request.Form["title"];
genre = Request.Form["genre"];
year = Request.Form["year"];
var db = Database.Open("WebPagesMovies");
var insertCommand = "INSERT INTO Movies (Title, Genre, Year) Values(@0, @1, @2)";
db.Execute(insertCommand, title, genre, year);
Response.Redirect("~/Movies");
}
}
I looked up the Redirect method of the Response class and it wasn't listed as static, which I'd assume to mean that it is an instance method. How am I able to use it without first creating an instance of the Response class?