MediaDescription media;
foreach(var field in fields) {
switch(field.Key) {
case FieldType.Version:
message.Version = Convert.ToInt32(field.Value);
break;
case FieldType.Originator:
message.Originator = OriginatorField.Parse(field.Value);
break;
...
...
case FieldType.Information:
if(media == null) <-- Use of local unassigned variable
message.Description = field.Value;
else media.Description = field.Value;
break;
...
I mean, why? The compiler should be smart enough to that I precheck the declaration and that only in the else-statement the declaration gets accessed. What's wrong?