Click here to Skip to main content
15,889,200 members
Home / Discussions / C#
   

C#

 
AnswerRe: No overload takes 5 arguments error (C# datagrid) Pin
saiprakash031516-Oct-12 5:52
saiprakash031516-Oct-12 5:52 
QuestionConverting from C to C# Pin
AseelHadlaq15-Oct-12 6:53
AseelHadlaq15-Oct-12 6:53 
AnswerRe: Converting from C to C# Pin
fjdiewornncalwe15-Oct-12 7:06
professionalfjdiewornncalwe15-Oct-12 7:06 
AnswerRe: Converting from C to C# Pin
jschell15-Oct-12 7:40
jschell15-Oct-12 7:40 
GeneralRe: Converting from C to C# Pin
AseelHadlaq15-Oct-12 8:30
AseelHadlaq15-Oct-12 8:30 
GeneralRe: Converting from C to C# Pin
jschell15-Oct-12 12:46
jschell15-Oct-12 12:46 
GeneralRe: Converting from C to C# Pin
AseelHadlaq16-Oct-12 5:38
AseelHadlaq16-Oct-12 5:38 
GeneralRe: Converting from C to C# Pin
jschell16-Oct-12 8:36
jschell16-Oct-12 8:36 
AnswerRe: Converting from C to C# Pin
Dave Doknjas15-Oct-12 9:41
Dave Doknjas15-Oct-12 9:41 
GeneralRe: Converting from C to C# Pin
AseelHadlaq16-Oct-12 5:43
AseelHadlaq16-Oct-12 5:43 
AnswerRe: Converting from C to C# Pin
DaveyM6915-Oct-12 11:30
professionalDaveyM6915-Oct-12 11:30 
GeneralRe: Converting from C to C# Pin
AseelHadlaq16-Oct-12 5:45
AseelHadlaq16-Oct-12 5:45 
AnswerRe: Converting from C to C# Pin
Bernhard Hiller15-Oct-12 22:35
Bernhard Hiller15-Oct-12 22:35 
GeneralRe: Converting from C to C# Pin
AseelHadlaq16-Oct-12 5:49
AseelHadlaq16-Oct-12 5:49 
GeneralRe: Converting from C to C# Pin
Pete O'Hanlon16-Oct-12 6:21
mvePete O'Hanlon16-Oct-12 6:21 
QuestionDirectoryEntry Questions Pin
Erick Kinnee15-Oct-12 4:37
Erick Kinnee15-Oct-12 4:37 
QuestionRe: DirectoryEntry Questions Pin
Richard MacCutchan15-Oct-12 4:45
mveRichard MacCutchan15-Oct-12 4:45 
AnswerRe: DirectoryEntry Questions Pin
Erick Kinnee15-Oct-12 4:49
Erick Kinnee15-Oct-12 4:49 
GeneralRe: DirectoryEntry Questions Pin
Richard MacCutchan15-Oct-12 5:04
mveRichard MacCutchan15-Oct-12 5:04 
AnswerRe: DirectoryEntry Questions Pin
Eddy Vluggen15-Oct-12 5:04
professionalEddy Vluggen15-Oct-12 5:04 
What is "over usage"? My apps are using a lot of ints, do you think it could leak memory due to that? It won't, and speed is not an indication for a memory-leak. The amount of used memory is an indication.

A few remarks on the code;
if (member.SchemaClassName == "Group")
{
    object admMembers = member.Invoke("members", null);
    foreach (object admMember in (IEnumerable)admMembers)
    {
        DirectoryEntry membername = new DirectoryEntry(admMember);
        DataRow dr = table.NewRow();
        dr["Machine"] = remMachine.Name.ToString();
        dr["Group"] = member.Name.ToString();
        dr["User"] = membername.Name.ToString();
        table.Rows.Add(dr);
        membername.Dispose();
    }
}
//Just a user, write it down
else if (member.SchemaClassName == "User")
{
    DataRow dr = table.NewRow();
    dr["Machine"] = remMachine.Name.ToString();
    dr["Group"] = "Administrators";
    dr["User"] = member.Name.ToString();
    table.Rows.Add(dr);
    member.Dispose();
}

Reads to me as;
if (something)
  membername.Dispose(); // are you sure? :)
else
  member.Dispose();

I'd expect something along these lines;
foreach (object groupMember in (IEnumerable)members)
{
  using (var member = new DirectoryEntry(groupMember))
  {
    //If it's a group, get the members.
    if (member.SchemaClassName == "Group")
..

You could gain some speed perhaps, if you had a thread for each result in there. Depends on how many results and how many cores your CPU got. A progressbar is often appreciated for longer-running tasks.
Bastard Programmer from Hell Suspicious | :suss:
if you can't read my code, try converting it here[^]

QuestionMessageBox error Pin
Saridakis Manolis14-Oct-12 23:36
Saridakis Manolis14-Oct-12 23:36 
AnswerRe: MessageBox error Pin
Sivaraman Dhamodharan14-Oct-12 23:39
Sivaraman Dhamodharan14-Oct-12 23:39 
AnswerRe: MessageBox error Pin
Pete O'Hanlon15-Oct-12 0:21
mvePete O'Hanlon15-Oct-12 0:21 
AnswerRe: MessageBox error Pin
Eddy Vluggen15-Oct-12 0:43
professionalEddy Vluggen15-Oct-12 0:43 
QuestionUnhandledException Pin
Hamid_RT14-Oct-12 3:38
Hamid_RT14-Oct-12 3:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.