Code:public virtual User this[string Username] { get { int index = -1; for (int i=0; i<this.List.Count; i++) { if (((User)this.List[i]).UserName==Username) { index = i; } } if (index==-1){throw new NullReferenceException ("The User " + Username + " was not found.");} if (!((User)this.List[index]).IsLoaded) { ((User)this.List[index]).Load(); } return (User) this.List[index]; } set { int index = -1; for (int i=0; i<this.List.Count; i++) { if (((User)this.List[i]).UserName==Username) { index = i; } } if (index==-1){throw new NullReferenceException ("The User " + Username + " was not found.");} this.List[index] = value; } }


Reply With Quote
