Skip to content

Instantly share code, notes, and snippets.

@ClysmiC
Created August 16, 2019 21:23
Show Gist options
  • Save ClysmiC/cd832f26e46be1ba337550ae50d5dc7d to your computer and use it in GitHub Desktop.
Save ClysmiC/cd832f26e46be1ba337550ae50d5dc7d to your computer and use it in GitHub Desktop.
public class SecureTransactor
{
public bool DoManySecureTransactions(string[] data)
{
if (!SecurityCheck()) return false;
bool doCheck = false; // We already did the check, no need to repeat ourselves!
foreach(string datum in data)
{
InternalDoSecureTranaction(data, doCheck);
}
}
public bool DoSecureTransaction(string data)
{
bool doCheck = true;
return InternalDoSecureTransactions(data, doCheck);
}
protected bool InternalDoSecureTransaction(string data, bool doSecurityCheck=true)
{
if (doSecurityChecks && !SecurityCheck())
{
return false;
}
// ...
return true;
}
protected bool SecurityCheck()
{
// ...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment