If you have a list which contains a SPFieldUser field (with multiple selection), you can add users too it with the following code:
using (SPSite site = new
SPSite("http://site"))
{
using (SPWeb web = site.AllWebs["Web"])
{
SPList list = web.Lists["List"];
SPListItem item = list.Items[0];
SPFieldUserValueCollection values = (SPFieldUserValueCollection)item["Users"];
SPUserCollection users = web.AllUsers;
foreach (SPUser user in users)
{
values.Add(new
SPFieldUserValue(web, user.ID, user.Name));
}
item["Users"] = values;
item.Update();
}
}
In this example the list "List" would contain a field with the name "Users", which takes users. All web users are added to the field "Users" of the first list item, which is then updated.