Click here to Skip to main content
15,921,643 members
Home / Discussions / C#
   

C#

 
AnswerRe: Format Strings Pin
Luc Pattyn31-Oct-07 11:37
sitebuilderLuc Pattyn31-Oct-07 11:37 
QuestionBinding with BindingSource Pin
~~~Johnny~~~31-Oct-07 10:18
~~~Johnny~~~31-Oct-07 10:18 
QuestionFinding column names of a dataset?? Pin
Goalie3531-Oct-07 10:15
Goalie3531-Oct-07 10:15 
AnswerRe: Finding column names of a dataset?? Pin
pmarfleet31-Oct-07 10:25
pmarfleet31-Oct-07 10:25 
Questiontabcontrol Pin
8213001231-Oct-07 9:55
8213001231-Oct-07 9:55 
AnswerRe: tabcontrol Pin
Hesham Amin31-Oct-07 11:36
Hesham Amin31-Oct-07 11:36 
QuestionApplying Object values to another object dynamically Pin
shwaguy31-Oct-07 9:30
shwaguy31-Oct-07 9:30 
AnswerRe: Applying Object values to another object dynamically Pin
eggsovereasy31-Oct-07 10:30
eggsovereasy31-Oct-07 10:30 
<br />
public class MyClass<br />
{<br />
  private readonly Dictionary<string, string> properties = new Dictionary<string, string>();<br />
<br />
  public string this[string name]<br />
  {<br />
    get { return properties[name]; }<br />
    set<br />
    {<br />
      if (properties.ContainsKey(name))<br />
        properties[name] = value;<br />
      else<br />
        properties.Add(name, value);<br />
    }<br />
  }<br />
<br />
  public void GetADObjectInfo(string dn)<br />
  {<br />
    DirectoryEntry entry = new DirectoryEntry("LDAP://" + dn);<br />
<br />
    foreach (string strAttrName in entry.Properties.PropertyNames)<br />
    {<br />
      this[strAttrName] = entry.Properties[strAttrName][0] as string;<br />
    }<br />
  }<br />
}<br />


Then access it like:

<br />
string myString = MyClass["PropertyName"];<br />


But you can't get it strongly typed (MyClass.PropertyName) without doing it one at a time I think.
QuestionDebug Application Plug-in Pin
CJ131-Oct-07 8:42
professionalCJ131-Oct-07 8:42 
AnswerRe: Debug Application Plug-in Pin
Pete O'Hanlon31-Oct-07 11:31
mvePete O'Hanlon31-Oct-07 11:31 
AnswerRe: Debug Application Plug-in Pin
Pete O'Hanlon31-Oct-07 11:40
mvePete O'Hanlon31-Oct-07 11:40 
GeneralRe: Debug Application Plug-in Pin
CJ11-Nov-07 4:47
professionalCJ11-Nov-07 4:47 
Questionarraylist as datagrid source [modified] Pin
The Onslaught31-Oct-07 8:20
The Onslaught31-Oct-07 8:20 
AnswerRe: arraylist as datagrid source Pin
eggsovereasy31-Oct-07 9:00
eggsovereasy31-Oct-07 9:00 
GeneralRe: arraylist as datagrid source Pin
The Onslaught1-Nov-07 6:48
The Onslaught1-Nov-07 6:48 
QuestionGuarantee MainForm Focus on Startup Pin
Sukhjinder_K31-Oct-07 8:19
Sukhjinder_K31-Oct-07 8:19 
AnswerRe: Guarantee MainForm Focus on Startup Pin
Judah Gabriel Himango31-Oct-07 8:19
sponsorJudah Gabriel Himango31-Oct-07 8:19 
Questionhow to turn a datatabel on sql interrogation ? Pin
eraydeniz31-Oct-07 8:04
eraydeniz31-Oct-07 8:04 
AnswerRe: how to turn a datatabel on sql interrogation ? Pin
pmarfleet31-Oct-07 8:20
pmarfleet31-Oct-07 8:20 
Questionwhy does my meesage box take attention twice? Pin
gizmokaka31-Oct-07 6:39
gizmokaka31-Oct-07 6:39 
AnswerRe: why does my meesage box take attention twice? Pin
gizmokaka31-Oct-07 6:49
gizmokaka31-Oct-07 6:49 
GeneralRe: why does my meesage box take attention twice? Pin
Luc Pattyn31-Oct-07 7:05
sitebuilderLuc Pattyn31-Oct-07 7:05 
QuestionSemaphore-like sync mechanism beetween multiple computers Pin
SGAYET31-Oct-07 6:31
SGAYET31-Oct-07 6:31 
AnswerRe: Semaphore-like sync mechanism beetween multiple computers Pin
led mike31-Oct-07 7:16
led mike31-Oct-07 7:16 
GeneralRe: Semaphore-like sync mechanism beetween multiple computers Pin
SGAYET4-Nov-07 21:21
SGAYET4-Nov-07 21:21 

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.