Click here to Skip to main content
15,899,314 members
Home / Discussions / C#
   

C#

 
GeneralRe: Convert into Url from Socket Pin
Anubhava Dimri25-Feb-11 21:29
Anubhava Dimri25-Feb-11 21:29 
GeneralRe: Convert into Url from Socket Pin
OriginalGriff25-Feb-11 21:33
mveOriginalGriff25-Feb-11 21:33 
GeneralRe: Convert into Url from Socket Pin
Anubhava Dimri25-Feb-11 23:04
Anubhava Dimri25-Feb-11 23:04 
GeneralRe: Convert into Url from Socket Pin
OriginalGriff25-Feb-11 23:23
mveOriginalGriff25-Feb-11 23:23 
GeneralRe: Convert into Url from Socket Pin
Anubhava Dimri26-Feb-11 1:53
Anubhava Dimri26-Feb-11 1:53 
GeneralRe: Convert into Url from Socket Pin
OriginalGriff26-Feb-11 2:00
mveOriginalGriff26-Feb-11 2:00 
GeneralRe: Convert into Url from Socket Pin
Anubhava Dimri27-Feb-11 17:18
Anubhava Dimri27-Feb-11 17:18 
Questionkeyword "dynamic" - real world applications? Pin
devvvy25-Feb-11 17:23
devvvy25-Feb-11 17:23 
Hi
I've been searching for any real world applications for C# keyword "dynamic"

Example 1 seems pretty lame as "interface" serves a purpose[^]

Example 2 - example don't seems to work, see code below.[^]

<br />
static void Test1()<br />
        {<br />
            System.Xml.XmlDocument xmlDoc = null;<br />
            System.Xml.XmlElement xmlElement = null;<br />
<br />
            try<br />
            {<br />
                // REF: http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.getelementbyid.aspx#Y790<br />
                xmlDoc = new System.Xml.XmlDocument();<br />
                xmlDoc.LoadXml(("<!DOCTYPE root [<!ELEMENT root ANY><!ELEMENT Person ANY><!ELEMENT Customer EMPTY><!ELEMENT Team EMPTY><!ATTLIST Person SSN ID #REQUIRED><!ATTLIST Customer id IDREF #REQUIRED ><!ATTLIST Team members IDREFS #REQUIRED>]><root><Person SSN='A111' Name='Fred'/><Person SSN='A111'/><Person SSN='A222' Name='Tom'/><Customer id='A111'/><Customer id='A222334444'/><Team members='A222334444 A333445555'/></root>"));<br />
                xmlElement = xmlDoc.GetElementById("A111");<br />
                Console.WriteLine(xmlElement.OuterXml);<br />
<br />
            }<br />
            catch (Exception Ex)<br />
            {<br />
                Console.WriteLine(Ex.Message);<br />
            }<br />
<br />
            return;<br />
        }<br />
<br />
        static void Test2()<br />
        {<br />
            dynamic xmlDoc = null;<br />
            dynamic xmlElement = null;<br />
<br />
            try<br />
            {<br />
                // REF: http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.getelementbyid.aspx#Y790<br />
                xmlDoc = new System.Xml.XmlDocument();<br />
                xmlDoc.LoadXml(("<!DOCTYPE root [<!ELEMENT root ANY><!ELEMENT Person ANY><!ELEMENT Customer EMPTY><!ELEMENT Team EMPTY><!ATTLIST Person SSN ID #REQUIRED><!ATTLIST Customer id IDREF #REQUIRED ><!ATTLIST Team members IDREFS #REQUIRED>]><root><Person SSN='A111' Name='Fred'/><Person SSN='A111'/><Person SSN='A222' Name='Tom'/><Customer id='A111'/><Customer id='A222334444'/><Team members='A222334444 A333445555'/></root>"));<br />
                xmlElement = xmlDoc.A111; // Runtime error here, sample don't work and is not a benefit offerred by dynamic<br />
                Console.WriteLine(xmlElement.OuterXml);<br />
<br />
            }<br />
            catch (Exception Ex)<br />
            {<br />
                Console.WriteLine(Ex.Message);<br />
            }<br />
<br />
            return;<br />
        }<br />


Example 3 - thus far, this seems to be best illustration: The Dynamic Keyword in C# 4.0. It shows how a method called can be done thru (i) Conventional OO interface, (ii) Reflection and (3) dynamic - but still in this example dynamic definitely beats reflection but conventional OO interface is type-safe, dynamic is not.[^]

I still haven't found one example where dynamic is "required" or shows a real promising use.

Anyone? Thanks
dev

AnswerRe: keyword "dynamic" - real world applications? Pin
SledgeHammer0125-Feb-11 17:50
SledgeHammer0125-Feb-11 17:50 
AnswerRe: keyword "dynamic" - real world applications? Pin
i.j.russell26-Feb-11 10:32
i.j.russell26-Feb-11 10:32 
QuestionRecursive Permutation Generator. Pin
shivamkalra25-Feb-11 13:37
shivamkalra25-Feb-11 13:37 
AnswerRe: Recursive Permutation Generator. Pin
PIEBALDconsult25-Feb-11 14:53
mvePIEBALDconsult25-Feb-11 14:53 
GeneralRe: Recursive Permutation Generator. Pin
Luc Pattyn25-Feb-11 15:01
sitebuilderLuc Pattyn25-Feb-11 15:01 
GeneralRe: Recursive Permutation Generator. Pin
PIEBALDconsult28-Feb-11 1:46
mvePIEBALDconsult28-Feb-11 1:46 
GeneralRe: Recursive Permutation Generator. Pin
shivamkalra25-Feb-11 16:47
shivamkalra25-Feb-11 16:47 
AnswerRe: Recursive Permutation Generator. Pin
Luc Pattyn25-Feb-11 15:02
sitebuilderLuc Pattyn25-Feb-11 15:02 
GeneralRe: Recursive Permutation Generator. Pin
shivamkalra25-Feb-11 16:39
shivamkalra25-Feb-11 16:39 
AnswerRe: Recursive Permutation Generator. Pin
Luc Pattyn25-Feb-11 16:58
sitebuilderLuc Pattyn25-Feb-11 16:58 
GeneralRe: Recursive Permutation Generator. Pin
shivamkalra25-Feb-11 17:22
shivamkalra25-Feb-11 17:22 
GeneralRe: Recursive Permutation Generator. Pin
Luc Pattyn25-Feb-11 17:32
sitebuilderLuc Pattyn25-Feb-11 17:32 
GeneralRe: Recursive Permutation Generator. Pin
shivamkalra25-Feb-11 17:53
shivamkalra25-Feb-11 17:53 
AnswerRe: Recursive Permutation Generator. Pin
Luc Pattyn25-Feb-11 17:58
sitebuilderLuc Pattyn25-Feb-11 17:58 
GeneralRe: Recursive Permutation Generator. Pin
shivamkalra25-Feb-11 18:20
shivamkalra25-Feb-11 18:20 
AnswerRe: Recursive Permutation Generator. [modified] Pin
Luc Pattyn25-Feb-11 17:14
sitebuilderLuc Pattyn25-Feb-11 17:14 
QuestionHelp with diagnosing a service failing [modified] Pin
turbosupramk325-Feb-11 11:15
turbosupramk325-Feb-11 11:15 

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.