Just in the reference of my earlier post add multi line of text programmatically, i come to know about one more thing.
I actually wanted to add one Hidden field in the list which also cannot be seen at the time of UI. we know that there is a property called Hidden that can be set to true and false.
But..but.. just try once, you will get an Error. Just Try this,
String Fieldid = spList.Fields.Add("
", SPFieldType.Text, false);
SPField objfield = spList.Fields.GetField(Fieldid );
objfield.Hidden = true;
And, see you will get and Error. The Error is because CanToggleHidden property of the Field is set to false, as a name suggest you cannot toggle the hidden property and that even cannot be set by code using property bag.
so all you need to do is use the same approach as i described in my previous post.
add multi line of text programmatically,
The difference is only this,
Type=\"Boolean\" Required=\"FALSE\" Name=\"yourfieldname\"
Here you actually set CanToggleHidden to TRUE and only because of this, you can change the Hidden to True in XML. this is not possible by directly setting the properties.
And then just set the Title Property to display name that you want.
There you go, now you will have the hidden field in your list.