issue when converting C#.net code into vb.net

issue when converting C#.net code into vb.net

Post by Dhananja » Wed, 30 Jan 2008 22:45:34


i All,

I am facing problem when i am converting C#.net code(Delegate concept)
into vb.net. I am unable to do that . Can someone help me to solve the
problem. I am providing my C#.net code.

==================================my code is :-
======================================
[DataObjectMethod(DataObjectMethodType.Select, false)]
static public List<MembershipUserWrapper> GetMembers(bool
returnAllApprovedUsers, bool returnAllNotApprovedUsers,
string usernameToFind, string sortData)
{

List<MembershipUserWrapper> memberList = new
List<MembershipUserWrapper>();

// See if we are looking for just one user
if (usernameToFind != null)
{
MembershipUser mu =
Membership.GetUser(usernameToFind);
if (mu != null)
{
MembershipUserWrapper md = new
MembershipUserWrapper(mu);
memberList.Add(md);
}
}
else
{
MembershipUserCollection muc =
Membership.GetAllUsers();
foreach (MembershipUser mu in muc)
{
if ((returnAllApprovedUsers == true &&
mu.IsApproved == true) ||
(returnAllNotApprovedUsers == true &&
mu.IsApproved == false))
{
MembershipUserWrapper md = new
MembershipUserWrapper(mu);
memberList.Add(md);
}
}

if (sortData == null)
{
sortData = "UserName";
}
if (sortData.Length == 0)
{
sortData = "UserName";
}


string sortDataBase = sortData;
string descString = " DESC";
if (sortData.EndsWith(descString))
{
sortDataBase = sortData.Substring(0,
sortData.Length - descString.Length);
}

Comparison<MembershipUserWrapper> comparison = null;

switch (sortDataBase)
{
case "UserName":
comparison = new
Comparison<MembershipUserWrapper>(
delegate(MembershipUserWrapper lhs,
MembershipUserWrapper rhs)
{
return
lhs.UserName.CompareTo(rhs.UserName);
}
);
break;
case "Email":
comparison = new
Comparison<MembershipUserWrapper>(
delegate(MembershipUserWrapper lhs,
MembershipUserWrapper rhs)
{
if (lhs.Email == null | rhs.Email ==
null)
{
return 0;
}
else
{
return
lhs.Email.CompareTo(rhs.Email);
}
}
);
break;
case "CreationDate":
comparison = new
Comparis