/// <summary>Checks for a given modifier e.g. 'private' in the given fragment of code.</summary> /// <param name="fragment">The fragment to check.</param> /// <param name="modifier">The modifier to check for.</param> /// <returns>True if this fragment contained the given modifier. The fragment is also removed from the code.</returns> public static bool Check(CodeFragment fragment,string modifier){ if(fragment==null||fragment.GetType()!=typeof(VariableFragment)){ return false; } bool result=(((VariableFragment)fragment).Value==modifier); if(result){ fragment.Remove(); } return result; }
/// <summary>Checks for a given modifier e.g. 'private' in the given fragment of code.</summary> /// <param name="fragment">The fragment to check.</param> /// <param name="modifier">The modifier to check for.</param> /// <returns>True if this fragment contained the given modifier. The fragment is also removed from the code.</returns> public static bool Check(CodeFragment fragment, string modifier) { if (fragment == null || fragment.GetType() != typeof(VariableFragment)) { return(false); } bool result = (((VariableFragment)fragment).Value == modifier); if (result) { fragment.Remove(); } return(result); }