If you want to modify the DefaultView of a programmatically created list you have to know a “bagatelle”.
First i tried it this way:
and nothing happened at all.
The reason lies in the property DefaultView which encapsulates a behavior in which in every call the View is instantiated again. So in the first line you would modifiy the first instance of the view. Than, you would update a new instance of the View, which is not modified or updated.
So, knowing this, what you have to do to make it working is the following:
Get the Instance, modifiy it, and safe it.
SPView view = list.DefaultView; if(view.ViewFields.Exists("internalName")==false) view.ViewFields.Add(list.Fields.GetFieldByInternalName("internalName"));