I googled but cannot find proper simple code for using backup database full and restore the backup, using defaults by using C#.
I am using C# Visual Studio 2008 and SQL Server 2008 R2 evalution but I guess SQL Server 2005 and C# will work too.
The Microsoft site doesn’t have code regarding it, it only show description of
And there’s a whole series of Getting Started with SMO in SQL Server 2005 which still very much applies to the 2008 and 2008 R2 versions of SQL Server.
Here’s another Getting started with SQL Server Management Objects (SMO) article to get you up to speed.
Here is an example with VB.NET
You can use a converter to get C#: