?
Solved

Convert VB.Net to C#

Posted on 2009-04-09
4
Medium Priority
?
221 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 2000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

800 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