Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hide variables from other programmers

Status
Not open for further replies.

Bigbass

Programmer
Feb 13, 2006
6
How do I prevent other programmers from viewing the values of class variables I have written?

I would like other programmers to use a string property like MyPWD, but not allow them to see the value of MyPWD when they debug.
 
you might want to use write only properties then.


example:

Code:
public MySecretClass

private _myPassword as string
Public WriteOnly Property MyPWD As String
   Set (Value as string)
      myPassword = value   'plus add some of your validation   code
   End Set
End Property

End Class

[\code]


Hope this helps, somehow.
Cheers
 
Thanks for the code, but not quite what I'm looking for.

Say myObject.mypwd is a string with a value. I want them to be able to assign value of that string to another string, but now allow them to see the value of the string.

I think I'm asking for something that can't be done.

 
I think I'm asking for something that can't be done.
Yep, pretty much. You can use version control to control who can edit certain pages, but if they have access to the page, you can't hide varialbes, controls, etc from the developer.

JIm
 
If you're using .NET v2.0 (VS.NET 2005), you can use the SecureString class, which encrypts the string as soon as you assign to it. If you put this into a property which only has a setter operation, this might be good enough for you.

You might also want to investigate code obfusticators, which manipulate your MSIL bytes to make decompilation more difficult.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top