Click here to Skip to main content
15,891,607 members
Home / Discussions / C#
   

C#

 
QuestionHow to correct X Axis scale label in .Net Chart Control Pin
Daniel Tong22-Jul-10 8:24
Daniel Tong22-Jul-10 8:24 
QuestionWebBrowser control automation question Pin
Etienne_12322-Jul-10 6:57
Etienne_12322-Jul-10 6:57 
AnswerRe: WebBrowser control automation question Pin
Etienne_12322-Jul-10 7:07
Etienne_12322-Jul-10 7:07 
QuestionMy TextBox lacks discipline and Forms.Focus Pin
GrenMeera22-Jul-10 5:48
GrenMeera22-Jul-10 5:48 
AnswerRe: My TextBox lacks discipline and Forms.Focus Pin
Peace ON22-Jul-10 19:45
Peace ON22-Jul-10 19:45 
GeneralRe: My TextBox lacks discipline and Forms.Focus Pin
GrenMeera23-Jul-10 3:08
GrenMeera23-Jul-10 3:08 
QuestionPassing a Varible to a TextBox in ReportViewer Pin
cgillespie22-Jul-10 3:56
cgillespie22-Jul-10 3:56 
QuestionDynamic Dictionary usage problem in C# Pin
glitteringsound22-Jul-10 3:22
glitteringsound22-Jul-10 3:22 
Hello,

I am using Dynamic dictionary in C#. The problem which I am facing , is the usage of TryGetMember behavior which i am overriding in dynamic dictionary class.

here's the code of dynamic dictionary.

class DynamicDictionary : DynamicObject
{
private IDictionary m_dictionary;

public DynamicDictionary(IDictionary<string, TValue> a_dictionary)
{
m_dictionary = a_dictionary;
}

public override bool TryGetMember(GetMemberBinder a_binder, out object a_result)
{
bool returnValue = false;

var key = a_binder.Name;
if (m_dictionary.ContainsKey(key))
{
a_result = m_dictionary[key];
returnValue = true;
}
else
a_result = null;

return returnValue;
}
}

Here TryGetMember will be called at runtime whenever we refer some key from outside. But strange here that binder's Name member which always give the key what we refer from outside. Strange here that it always resolve the key name what written as characters of alphabets.

e.g if make the object of DynamicDictionary as

Dictionary<string,List<String>> dictionaryOfStringVsListOfStrings;

dictionaryOfStringVsListOfStrings.Add("Test", listOfStrings); //here listOfStrings some strings list already populated with strings

dynamic dynamicDictionary_01 = new DynamicDictionary(dictionaryOfStringVsListOfStrings);

string somekey = "Test";

List listOfStringsAsValue = dynamicDictionary_01.somekey //will be resolve at runtime

Now here what happens actually "somekey" will become the value of a_binder (i.e a_binder.Name="somekey") what I need that key assigned value should be resolved as key. i.e it should be resolved as a_binder.Name = "Test" and then from dynamic dictionary it will locate listOfStrings against this key i.e actually "Test" but it resolves not the value but actual variable name as key..

Way around?

Regards Usman
QuestionMDIChild form in FULLSCREEN mode Pin
frommi22-Jul-10 0:05
frommi22-Jul-10 0:05 
AnswerRe: MDIChild form in FULLSCREEN mode Pin
Peace ON22-Jul-10 0:16
Peace ON22-Jul-10 0:16 
GeneralRe: MDIChild form in FULLSCREEN mode Pin
frommi22-Jul-10 0:25
frommi22-Jul-10 0:25 
GeneralRe: MDIChild form in FULLSCREEN mode Pin
Peace ON22-Jul-10 2:04
Peace ON22-Jul-10 2:04 
GeneralRe: MDIChild form in FULLSCREEN mode Pin
Ravi Bhavnani22-Jul-10 4:19
professionalRavi Bhavnani22-Jul-10 4:19 
GeneralRe: MDIChild form in FULLSCREEN mode Pin
Matt U.22-Jul-10 11:57
Matt U.22-Jul-10 11:57 
AnswerRe: MDIChild form in FULLSCREEN mode Pin
Niyamat22-Jul-10 7:47
Niyamat22-Jul-10 7:47 
Questionhow to auto Refresh a control in windows application Pin
Krishna Varadharajan21-Jul-10 23:20
Krishna Varadharajan21-Jul-10 23:20 
AnswerRe: how to auto Refresh a control in windows application Pin
Peace ON22-Jul-10 0:09
Peace ON22-Jul-10 0:09 
GeneralRe: how to auto Refresh a control in windows application Pin
Krishna Varadharajan22-Jul-10 20:10
Krishna Varadharajan22-Jul-10 20:10 
Questionreplacing html entity [modified] Pin
varsh1221-Jul-10 22:43
varsh1221-Jul-10 22:43 
AnswerRe: replacing html entity Pin
Rajesh Sajjanar22-Jul-10 2:25
Rajesh Sajjanar22-Jul-10 2:25 
GeneralRe: replacing html entity Pin
varsh1222-Jul-10 2:35
varsh1222-Jul-10 2:35 
AnswerRe: replacing html entity Pin
Peace ON22-Jul-10 2:34
Peace ON22-Jul-10 2:34 
QuestionSocket port listen Pin
anishkannan21-Jul-10 21:48
anishkannan21-Jul-10 21:48 
AnswerRe: Socket port listen Pin
jschell22-Jul-10 8:22
jschell22-Jul-10 8:22 
AnswerRe: Socket port listen Pin
T M Gray22-Jul-10 9:01
T M Gray22-Jul-10 9:01 

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.