Hi Developers !
I'am a newer of C#,once i want to practice how to Invoke Unmanaged code
And i got the Assembly:Microsoft.ActiveDirectory.Management.dll,to practice how to use
ADUser Constructors to create an abject whose properties are similar to a ADUser classs in my view.
Then print all properties and methods of the abject
Although i have been read about PlatformInvoke topic in "C# advancing programming" but i also can not perform my Task
Why not i come to DirectoryEntry class to get the abject ,because this method need a path parameter that is related to Active Directory
And i want this code Active Directory independence and also without customing a class ,can it be realized
Anyone can help with some suggestions,below is my code:
using System;
using System.Runtime.InteropServices;
using Microsoft.ActiveDirectory.Management;
using System.Reflection;
namespace Test
{class Program
{
static void Main(string[] args)
{
var ADAccount = new ADUser();
Type t = ADAccount.GetType();
foreach (PropertyInfo pi in t.GetProperties())
{
string name = pi.Name;
Console.WriteLine(pi.Name);
Console.ReadKey();
}
}
}
namespace Microsoft.ActiveDirectory.Management
{
public class ADUser
{
public ADUser() { }
}
}
}