asp.net - Why am I getting: 'System.Collections.IEnumerable' has no type parameters and so cannot have type arguments? -


this simple username , password login has ability redirect user different 'members area' page.

however a:

bc32045: 'system.collections.ienumerable' has no type parameters , cannot have type arguments

and have no idea why.

can help?

thanks, david.

public class mypage inherits page private structure cred     public username string     public password string     public redirecturl string     public sub new(un string, pw string, optional ru string = "/admin/default.aspx")         username = un         password = pw         redirecturl = ru     end sub end structure  private readonly _credentials ienumerable(of cred) = new () {new cred("userone", "passwordone"), new cred("usertwo", "passwordtwo"), new cred("userthree", "passwordthree", "/admin/custom.aspx")}  public sub page_load(sender object, e eventargs)     dim user = _credentials.singleordefault(function(x) x.username = username.text andalso x.password = password.text)     if user isnot nothing         session("admin") = true         response.redirect(user.redirecturl)     else         session("admin") = false         ltllogin.text = "<p>sorry, have provided incorrect login details.</p>"     end if end sub end class 

i "type expected" compiler error correct. either remove new(), replace

private readonly _credentials ienumerable(of cred) = new () {new cred("userone", "passwordone"), new cred("usertwo", "passwordtwo"), new cred("userthree", "passwordthree", "/admin/custom.aspx")} 

with

private readonly _credentials ienumerable(of cred) =  {new cred("userone", "passwordone"), new cred("usertwo", "passwordtwo"), new cred("userthree", "passwordthree", "/admin/custom.aspx")} 

or use new cred(){...}

however, should use class instead of struct. option strict can't use if user isnot nothing since cred structure, hence value type.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -