DimtriTheBlyat
DimtriTheBlyat

Reputation: 11

VB.net to c# error and i dont understand why

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?

Upvotes: 1

Views: 79

Answers (1)

pm100
pm100

Reputation: 50180

C# syntax for this is

cookies.GetCookies(..)[defaultCookieName]

Upvotes: 1

Related Questions