And don't do this
for (int i =0;i<this.cookies.ToArray().Length;i++)
because
this.cookies.toArray().Length
its evaluating in every iteration of the for loop, you are making 'this.cookies' to array every time so just you get its length? :) You are increasing the complexity of the method