Gets the list of fields.
A field is a single value in an item. The template of an item defines which fields an item has. The value of a field is always a string, but a the type of a field determines the semantics of the value. A field always has a name and an ID that uniquely identifies the field.
The list only contains the fields that have content. Empty fields are omitted. To get all fields defined by the item template, use the ReadAll method.
To change the field values or name of an item, the item must be in editing mode. An item can enter editing mode by calling BeginEdit and leave using EndEdit. If the item is being edited without being in editing mode, an exception is raised. Changes to the items, is committed to the database when the editing mode is left.
This example gets the french text field of an item.
public string GetFrenchText(ID id) {
Language language = Language.Parse("fr");
Item item = Sitecore.Context.Database.Items[id, language];
if (item != null) {
return item["Text"];
}
return "";
}
Item Class | Sitecore.Data.Items Namespace