Click here to Skip to main content
15,887,746 members
Home / Discussions / C#
   

C#

 
AnswerRe: Alright. How the heck to they do it? Pin
Kenneth Haugland4-Dec-17 0:30
mvaKenneth Haugland4-Dec-17 0:30 
GeneralRe: Alright. How the heck to they do it? Pin
#realJSOP4-Dec-17 3:02
mve#realJSOP4-Dec-17 3:02 
GeneralRe: Alright. How the heck to they do it? Pin
Kenneth Haugland4-Dec-17 3:12
mvaKenneth Haugland4-Dec-17 3:12 
GeneralRe: Alright. How the heck to they do it? Pin
#realJSOP4-Dec-17 3:15
mve#realJSOP4-Dec-17 3:15 
GeneralRe: Alright. How the heck to they do it? Pin
Richard Deeming4-Dec-17 4:32
mveRichard Deeming4-Dec-17 4:32 
GeneralRe: Alright. How the heck to they do it? Pin
#realJSOP4-Dec-17 7:03
mve#realJSOP4-Dec-17 7:03 
AnswerRe: Alright. How the heck to they do it? Pin
Nathan Minier4-Dec-17 1:21
professionalNathan Minier4-Dec-17 1:21 
AnswerRe: Alright. How the heck to they do it? Pin
Richard Deeming4-Dec-17 2:03
mveRichard Deeming4-Dec-17 2:03 
There's a static helper method on the System.Web.Mvc.HtmlHelper class:
public static RouteValueDictionary AnonymousObjectToHtmlAttributes(object htmlAttributes)[^]

That delegates to the System.Web.WebPages.Html.HtmlHelper class:
public static RouteValueDictionary AnonymousObjectToHtmlAttributes(object htmlAttributes)[^]

That uses the internal System.Web.WebPages.HtmlAttributePropertyHelper[^] class, which inherits from the PropertyHelper[^] class, which finally uses reflection to read the properties of the anonymous type:
protected static PropertyHelper[] GetProperties(object instance, Func<PropertyInfo, PropertyHelper> createPropertyHelper, ConcurrentDictionary<Type, PropertyHelper[]> cache)[^]

If you just want to use the same behaviour, the simplest option is to call the helper method.



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: Alright. How the heck to they do it? Pin
#realJSOP4-Dec-17 3:03
mve#realJSOP4-Dec-17 3:03 
Questionhow to clear file folder search on computer? Pin
Le@rner1-Dec-17 18:59
Le@rner1-Dec-17 18:59 
AnswerRe: how to clear file folder search on computer? Pin
OriginalGriff1-Dec-17 20:05
mveOriginalGriff1-Dec-17 20:05 
AnswerRe: how to clear file folder search on computer? Pin
Richard MacCutchan1-Dec-17 22:03
mveRichard MacCutchan1-Dec-17 22:03 
GeneralRe: how to clear file folder search on computer? Pin
Mycroft Holmes2-Dec-17 12:40
professionalMycroft Holmes2-Dec-17 12:40 
AnswerRe: how to clear file folder search on computer? Pin
Gerry Schmitz2-Dec-17 4:02
mveGerry Schmitz2-Dec-17 4:02 
QuestionTable object Pin
Member 1354537529-Nov-17 19:56
Member 1354537529-Nov-17 19:56 
AnswerRe: Table object Pin
OriginalGriff29-Nov-17 20:08
mveOriginalGriff29-Nov-17 20:08 
GeneralRe: Table object Pin
Member 1354537529-Nov-17 21:59
Member 1354537529-Nov-17 21:59 
GeneralRe: Table object Pin
OriginalGriff29-Nov-17 22:23
mveOriginalGriff29-Nov-17 22:23 
AnswerRe: Table object Pin
Richard MacCutchan29-Nov-17 21:47
mveRichard MacCutchan29-Nov-17 21:47 
GeneralRe: Table object Pin
Member 1354537529-Nov-17 21:57
Member 1354537529-Nov-17 21:57 
GeneralRe: Table object Pin
Richard MacCutchan29-Nov-17 22:03
mveRichard MacCutchan29-Nov-17 22:03 
GeneralRe: Table object Pin
Member 1354537529-Nov-17 22:14
Member 1354537529-Nov-17 22:14 
GeneralRe: Table object Pin
Richard MacCutchan29-Nov-17 22:59
mveRichard MacCutchan29-Nov-17 22:59 
GeneralRe: Table object Pin
Member 1354537529-Nov-17 23:11
Member 1354537529-Nov-17 23:11 
QuestionMatching Percent Symbol Using REGEX Pin
Liagapi29-Nov-17 15:31
Liagapi29-Nov-17 15:31 

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.