c# object generic use without casting? -


object s; s = "abc"; int n = ((string)s).length; 

is there way of avoiding having use cast in 3rd line?

edit: "string" , "length" examples , different.

edit: further clarified regarding var , dynamic breaking first line more requirements.

dynamic s = "abc"; int n = s.length; 

Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -