My below code worked fine while running in .NET 4.0 but when I run the same code in .NET 2.0 I am getting an error at var I found that var is not accepted in .NET 2.0 and older but my Plesk 9.0.1 do not allow me to use .NET 4.0 also I cannot upgrade my plesk at this time because of traffic to my server. Well, anybody please convert the below code such that is works even with .NET 2.0. Thanks in advance.
var app = new hMailServer.Application();
app.Authenticate("Administrator", "********");
var domain = app.Domains.get_ItemByName("mydomain.ext");
var account = domain.Accounts.Add();
account.Address = "user@mydomain.ext";
account.Password = "secret";
account.Active = true;
account.MaxSize = 1000;
account.PersonFirstName = "";
account.Save();
Just instead of var what can I use? I tried string which is not accepted. Any idea?
First line I used as hMailServer.Application app = new hMailServer.Application(); Its accepted bur at the var domain and var account .NET 2.0 is not accepting.
Use the actual types (read the documentation of the API you are using to understand what those types are):
Also note that
varwas introduced in C# 3.0 and not 4.0.