I am pretty new to C# (and anything really other than web languages). I am trying to understand two keywords in C# dealing with polymorphism. Can you please tell me if the following is correct?
New keyword – just states that there is a method in the child class with the same name as one in the base class, prevents an error. Hides the child method from the parent method.
Override keyword - Child method that actually overrides...
User Profile
Collapse
-
Thank you. I found that the below works great for my purpose.
[code=cfm]
<cfif #ID# NEQ #chkChanged#>
Changed
<cfelse>
Unchanged
</cfif>
[/code]
With most of everything else above. So I can basically compare to see if the lists are the exact same using "valuelist" to turn the query into a comma separated list without a loop. -
As a temporary fix, I turned the array into a list. I then am checking the list length to see if there are any changes. The only problem is if they select and then de-select the same amount.
...Code:<cfif IsDefined('form.chkChanged')> <cfset ID=quotedvalueList(qry.ID)> <cfset chkChanged=#form.chkChanged#> <cfif #ListLen(ID)# NEQ #ListLen(chkChanged)#> changedLeave a comment:
-
I guess I really want to know if there is a way to compare a list to a list, or a list to an array. Looping over just gives me the last value of the field. All I want to know is if anything has changed. Not exactly what has changed.Leave a comment:
-
Looping through list and comparing to database field problem
My situation:
I have a dynamic form with checkboxes. The checkboxes are submitted and added to a database. They are a list.
I want to compare the list with what is currently listed in the database. If there is anything new or removed, I want to know with a variable that says changed.
Basically:
Checkboxes = 1,2,3
Database rows and fields are:
row | field
1 | 2
2| 3
I want...Last edited by acoder; Apr 2 '12, 10:57 AM. -
Thank you again. I ended up using regEx and the search() function.
It seems to work okay...Code:var contnum = new RegExp('/,?' + contID[i].value + ',?/'); if(dispCA.join().search(contnum)>=0) {Leave a comment:
-
I hadn't thought of using regex, but that may work as a great possiblity, thanks :) .
What I'm actually trying to do is look for a number within an array. The number is dynamically set as is the array. Indexof was working correctly, but then I realized my error.
Here is a snippet:
...Code:var dispCA = new Array(<cfoutput query="getCA">#id#<cfif getCA.currentRow LT getCA.recordCount>,</cfif></cfoutput>);
Leave a comment:
-
Search for a number in a string or in an array
What would be the best way to search for a number within a string or an array in javascript? I'm currently using indexof - but if I am searching for 1, would it also return true if the number ends up being 11 or 111?
No activity results to display
Show More
Leave a comment: