title: How to sanitize/hide sensitive data in C#
body: <p>For logging transactions purpose, I need to tell whether users provide the necessary fields/information or not.
  If yes, I will replace the real information with *.
  If no, I will make this request as failed one, with returning "false" value.</p>
  
  <p>The following are the data definition class and method.</p>
  
  <pre><code>public class CreditCard
  {
   public string brand { get; set; }
   public string billingphone { get; set; }
  }   
  
  class Program
  {
     static void Main(string[] args)
     {
      CreditCard creditcard =new CreditCard(){brand="VISA", billingphone="777-111-2222"};
      bool IsVerified= SanitizePaymnetData(creditcard);        
     }
  
    private bool SanitizePaymnetData(ref CreditCard creditcard)
      {
          bool isDataSanitized = true;
  
          if(!String.IsNullOrEmpty(creditcard.brand))
          {
             creditcard.brand ="*";               
          }
          else
          {
              isDataSanitized = false;
          }
  
          if (!String.IsNullOrEmpty(creditcard.billingphone))
          {
              creditcard.billing_phone = "*";
          }
          else
          {
              isDataSanitized = false;
          }
  
          return isDataSanitized;
      } 
  }
  </code></pre>
  
  <p>The "SanitizePaymentData" method looks kind of ugly.
     Is there any way to make it more clean/neat?</p>