1
votes

Hello i tried converting this but i dont seem to figure out why.

Im working on a external log in for my forum

public override bool isLoggedIn(System.Net.CookieContainer cookies)
{
    if ((cookies.GetCookies(new Uri(url)).Item(defaultCookieName) != null)) {
        return true;
    }
    return false;
}

but it gives me this annoying error.

Severity Code Description Project File Line Suppression State Error CS1061 'CookieCollection' does not contain a definition for 'Item' and no extension method 'Item' accepting a first argument of type 'CookieCollection' could be found (are you missing a using directive or an assembly reference?)

Could anyone help me out?

1
try cookies.GetCookies(new Uri(url))[defaultCookieName] and let us know if that fixes itSimon Wilson
"Item" is the placeholder in the MSDN documentation for the indexer of the class. The one you use without a name and [square brackets]. Let the Intellisense popup help you fall in the pit of success.Hans Passant

1 Answers

1
votes

C# syntax for this is

cookies.GetCookies(..)[defaultCookieName]