If you are not sure, the required List is present in the web,
you can use
SPList list = web.Lists.TryGetList(“ListName”);
//if your list doesn’t exist, it will return null
if (list != null)
{
// ur code
}
If you are not sure, the required List is present in the web,
you can use
SPList list = web.Lists.TryGetList(“ListName”);
//if your list doesn’t exist, it will return null
if (list != null)
{
// ur code
}