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;
...
我的意思是,为什么?编译器应该足够聪明,我可以预先检查声明,并且只有在 else 语句中才能访问声明。怎么了?