Click here to Skip to main content
15,885,985 members
Articles / Programming Languages / C# 4.0

Adventures with C# 4.0 dynamic - ExpandoObject, ElasticObject, and a Twitter client in 10 minutes

Rate me:
Please Sign up or sign in to vote.
4.89/5 (64 votes)
29 Mar 2010CPOL7 min read 209.7K   4.4K   144  
Explores the dynamic features in C# 4.0, and a few cool things you can do with the same.
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" 
                                          Inherits="System.Web.Mvc.ViewPage<dynamic>" %>   
<asp:Content ID="indexTitle" ContentPlaceHolderID="TitleContent" runat="server">
    Home Page
</asp:Content>
<asp:Content ID="indexContent" ContentPlaceHolderID="MainContent" runat="server">
    <h2><%= Html.Encode(Model.MyTitle) %></h2>
    <p>
    <%using (Html.BeginForm())
      { %>
      Search Twitter: <%=Html.TextBox("query")%> <input type="submit" value="Search"/>
     <ul>
       <%  foreach (var entry in Model.entry_All)
           { %>    
       
              <li> <image height=24 width=24 src=<%=entry.link_All[1].href%> align="middle" /> 
              <a href="<%=Html.Encode(~entry.author.uri) %>"> <%=Html.Encode(~entry.author.name)%></a>
              </li>
              <ul>
              <li><%= Html.Encode(~entry.title)%> </li>
              <li><small>
              <a href="<%=entry.link_All[0].href %>">View</a> | Date <%=Html.Encode(~entry.published) %> 
              </small></li>
              </ul>
        <% }%>        
     </ul>           
     <%} %>     
    </p>
</asp:Content>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect
India India
Architect, Developer, Speaker | Wannabe GUT inventor & Data Scientist | Microsoft MVP in C#

Comments and Discussions