Assigning a value to a class variable I have tried the following code:

SystemUser user = (SystemUser)Session["CurrentUser"];
Data.Configuration configuration = db.Configurations.Single(c =&gt; c.ID == user.ID);
MailAddress from = new MailAddress("noreply@test.com", "Test");
if (configuration.EmailFromAddress != null)
{
    from = new MailAddress(configuration.EmailFromAddress, "Test"); 
}


Here I declare the from variable of the MailAddress class with a default value, and if configuration.EmailFromAddress exists, I am assigning that value to the from.

Is this following best practice?

Here, the MailAddress class is calling twice to assign the value.  Is it good performance and memory wise? Another implementation is using a string variable:

SystemUser user = (SystemUser)Session["CurrentUser"];
Data.Configuration configuration = db.Configurations.Single(c =&gt; c.ID == user.ID);
string fromAddress = "noreply@test.com";
if (configuration.EmailFromAddress != null)
{
    fromAddress = configuration.EmailFromAddress;
}
MailAddress from = new MailAddress(fromAddress, "Test");


Which one follows best practice?
If you are sure that configuration.EmailFromAddress will always be valid or null, I'd suggest using the null-coalescing operator (??)

SystemUser user = (SystemUser)Session["CurrentUser"];
Data.Configuration configuration = db.Configurations.Single(c =&gt; c.ID == user.ID);
var fromAddress = configuration.EmailFromAddress ?? "noreply@test.com";
MailAddress from = new MailAddress(fromAddress, "Test");


In the case that configuration.EmailFromAddress can also be empty, I'd use the ternary operator

SystemUser user = (SystemUser)Session["CurrentUser"];
Data.Configuration configuration = db.Configurations.Single(c =&gt; c.ID == user.ID);
var fromAddress = String.IsNullOrEmpty(configuration.EmailFromAddress) ? configuration.EmailFromAddress : "noreply@test.com";
MailAddress from = new MailAddress(fromAddress, "Test");