Join us in building a kind, collaborative learning community via our updatedCode of Conduct.

Questions tagged [dynamic]

Dynamic is a widely used term that, in general, describes a decision made by the program at run-time rather than at compile time.

2743
votes
19answers
633k views

What is the difference between call and apply?

What is the difference between using call and apply to invoke a function?var func=function() {alert('hello!');};func.apply(); vs func.call();Are there performance differences between the ...
777
votes
23answers
524k views

Deserialize JSON into C# dynamic object?

Is there a way to deserialize JSON content into a C# 4 dynamic type? It would be nice to skip creating a bunch of classes in order to use the DataContractJsonSerializer.
332
votes
3answers
146k views

What's the difference between eval, exec, and compile in Python?

I've been looking at dynamic evaluation of Python code, and come across the eval() and compile() functions, and the exec statement.Can someone please explain the difference between eval and exec, ...
283
votes
5answers
444k views

Dynamically add elements to a listView Android

Can anyone explain or suggest a tutorial to create a listView in android? Here are my requirements:I should be able to dynamically add new elements by pressing a button.Should be simple enough to ...
221
votes
5answers
109k views

Are parameters in strings.xml possible? [duplicate]

In my Android app I'am going to implement my strings with internationalization. So currently I got a problem with the grammar and the way sentences build in different languages.For example: "5 ...
184
votes
3answers
78k views

Dynamically adding properties to an ExpandoObject

I would like to dynamically add properties to a ExpandoObject at runtime. So for example to add a string property call NewProp I would like to write something likevar x=new ExpandoObject();x....
183
votes
12answers
85k views

Test if a property is available on a dynamic variable

My situation is very simple. Somewhere in my code I have this:dynamic myVariable=GetDataThatLooksVerySimilarButNotTheSame();//How to do this?if (myVariable.MyProperty.Exists) //Do stuffSo, ...
180
votes
14answers
69k views

What's the difference between dynamic (C# 4) and var?

I had read a ton of articles about that new keyword that is shipping with C# v4, but I couldn't make out the difference between a "dynamic" and "var".This article made me think about it, but I still ...
177
votes
11answers
69k views

How to implement a rule engine?

I have a db table that stores the following:RuleID objectProperty ComparisonOperator TargetValue1 age 'greater_than' 152 username 'equal' '...
168
votes
10answers
73k views

How to detect if a property exists on an ExpandoObject?

In javascript you can detect if a property is defined by using the undefined keyword: if( typeof data.myProperty=="undefined" ) ...How would you do this in C# using the dynamic keyword with an ...
162
votes
10answers
98k views

What is the 'dynamic' type in C# 4.0 used for?

C# 4.0 introduced a new type called 'dynamic'. It all sounds good, but what would a programmer use it for?Is there a situation where it can save the day?
152
votes
10answers
52k views

Dynamic Anonymous type in Razor causes RuntimeBinderException

I'm getting the following error:'object' does not contain a definition for 'RatingName'When you look at the anonymous dynamic type, it clearly does have RatingName.I realize I can do this with ...
143
votes
4answers
240k views

javascript - change form action based on selection?

I'm trying to change the form action based on the selected value from a dropdown menu... Basically, the html looks like this:<form class="search-form" id="search-form" method="post" accept-...
143
votes
8answers
158k views

Get value of c# dynamic property via string

I'd like to access the value of a dynamic c# property with a string:dynamic d=new { value1="some", value2="random", value3="value" };How can I get the value of d.value2 ("random") if I ...
140
votes
7answers
163k views

Using braces with dynamic variable names in PHP

I'm trying to use dynamic variable names (I'm not sure what they're actually called) But pretty much like this:for($i=0; $i<=2; $i++) {$("file" . $i)=file($filelist[$i]);}var_dump($...

153050per page
angop.ao, elkhabar.com, noa.al, afghanpaper.com, bbc.com, time.com, cdc.gov, nih.gov, xnxx.com, github.com,