Solved

Convert VB.Net to C#

Posted on 2009-04-09
4
219 Views
Last Modified: 2013-12-17
Hi folks

Can anybody help me work out what the following would be in C#?  Have tried the usual online converting tools but don't seem to be giving me working code:
 For Each sr As SearchResult In src
                cmbSetupAddUserDomainUsers.Items.Add(sr.Properties.Item("samaccountname").Item(0))
                domainUsers.Add(sr.Properties.Item("samaccountname").Item(0), sr)
            Next

src is a SearchResultCollection.  And C# doesn't have a Properties.Item, I tried PropertyNames and Values but they didn't work (must be doing it wrong)
0
Comment
Question by:angus_young_acdc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 22

Expert Comment

by:p_davis
ID: 24107270
i am not familiar with that class
but is this what you are trying to accomplish?

http://msdn.microsoft.com/en-us/library/system.directoryservices.searchresult.properties(VS.71).aspx
0
 
LVL 29

Accepted Solution

by:
Gautham Janardhan earned 500 total points
ID: 24107279
cmbSetupAddUserDomainUsers.Items.Add(sr.Properties["samaccountname"][0])
0
 
LVL 29

Expert Comment

by:Gautham Janardhan
ID: 24107290
domainUsers.Add(sr.Properties["samaccountname"][0], sr)
0
 
LVL 15

Expert Comment

by:oobayly
ID: 24107511
I use this site all the time for converting code to and from vb.net. Especially as I always do my code in c# and convert to vb.net when anwering vb.net questions :-)
http://www.developerfusion.com/tools/convert/csharp-to-vb/
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question