Is there any way to refactor this code to not have to use a temporary variable and still use the syntactic sugar associated with object initializers?
FrmSomeForm someTempForm = new FrmSomeForm()
{
SomePropA = "A",
SomePropB = "B",
SomePropC = "C"
};
using (FrmSomeForm someForm = someTempForm)
{
someForm.ShowDialog();
}
using (FrmSomeForm someForm = new FrmSomeForm(){
SomePropA = "A",
SomePropB = "B",
SomePropC = "C"
})
{
someForm.ShowDialog();
}
doesn't this work? oO