2008-12-03

CODING: Add "compare" to "get" and "set"

For the coders out there, you may be familiar with C#, and how it includes "get" and "set" functions. I was thinking there should be a third function called "compare". Many times in code, I need to know if a value matches what an object has in a property. Rather than using "get" and writing extraneous code over and over, why not a simple "compare"?

Example:

tempvar = object.property.get()
if (tempvar = comparevar) ...

if (object.property.compare(comparevar)) ...

It probably gets more complicated than that, but you get the idea

No comments: