What is the recommended C# DataType for holding credit card information?

If I just encrypt a string with a credit card number, the old unencrypted one is still hanging around for a bit until it’s garbage collected. The encryption is written to a new copy. The same issue arises if we try to overwrite the old string when done with it, i.e. the original string becomes unreferenced and new string is created for the overwrite.

I did wonder about SecureString but this discussion seems to identify issues with it:
http://stackoverflow.com/questions/27973858/c-sharp-and-removing-sensitive-data-and-all-garbage-collection-copies-from-memor 

What is the recommended way of holding credit card details in C#?
purplesoupAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AndyAinscowFreelance programmer / ConsultantCommented:
I'd suggest using arrays of characters - then you can overwrite the characters with different ones when you don't require them any more.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
purplesoupAuthor Commented:
Apparently there are issues with character arrays getting swapped to disk - but no one else answered so you can have the points.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.