private static SPList createListImpl(SPWeb web, string Title, string Description, SPListTemplate template) { web.RequireNotNull("web"); Title.RequireNotNullOrEmpty("Title"); Description.RequireNotNullOrEmpty("Description"); template.RequireNotNull("template"); Guid listGuid = web.Lists.Add(Title, Description, template); return web.Lists[listGuid]; }
public SPList CreateList(SPWeb web, string Title, string Description, SPListTemplate template) { web.RequireNotNull("web"); Title.RequireNotNullOrEmpty("Title"); Description.RequireNotNullOrEmpty("Description"); template.RequireNotNull("template"); SPList list = web.Lists.TryGetList(Title); return null != list ? list : createListImpl(web, Title, Description, template) ; }