You should probably create have a class that encapsulates the URL list and the behavior you want. I guess the behavior is that the list gets "full" when it hits 3 items and then you want an event to be raised that MyClass can listen on.
class MyUrls
{
List<string> _urls = new List<string>();
public void Add(string url)
{
_urls.Add(url);
if (_urls.Count == 3 && OnFull != null)
OnFull.Invoke();
}
public IEnumerable<string> Urls
{
get
{
return _urls;
}
}
public event Action OnFull;
}
and use it like this:
public class MyClass
{
public MyClass()
{
Urls.OnFull += fullList;
}
public MyUrls Urls { get; }
public void fullList()
{
//some work with the List
}
}
MyClass mc = new MyClass();
mc.Urls = new List<string>();
mc.Urls.Add("www.1.com");
mc.Urls.Add("www.2.com");
//now on 3rd added item I want to invoke method fullList from class MyClass
mc.Urls.Add("www.3.com");