Take screenshot of the webpage using Selenium C#

Following script is used to take screenshot of the webpage and save in your local drive. (using C#)

ITakesScreenshot screen = driver as ITakesScreenshot;  // ITakesScreenshot is  an interface inside OpenQA.Selenium namespace
Screenshot scrnst = screen.GetScreenshot();  // Screenshot is a class inside OpenQA.Selenium namespace
string screenshot = "c:\\screens\\myScreenShot1.png";
scrnst.SaveAsFile(screenshot, ImageFormat.Png);