Пример #1
0
 /// <summary>
 /// Adds a branch with the given option and value to the case expression.
 /// </summary>
 /// <param name="option">The value that the case item must equal for given the result to be returned.</param>
 /// <param name="value">The value to return when the item equals the option.</param>
 public MatchCaseBranch AddBranch(IProjectionItem option, IProjectionItem value)
 {
     if (option == null)
     {
         throw new ArgumentNullException("option");
     }
     if (value == null)
     {
         throw new ArgumentNullException("value");
     }
     MatchCaseBranch branch = new MatchCaseBranch();
     branch.Option = option;
     branch.Value = value;
     branches.Add(branch);
     return branch;
 }
Пример #2
0
 /// <summary>
 /// Removes the branch.
 /// </summary>
 /// <param name="branch">The branch to be removed.</param>
 /// <returns>True if the branch was found; otherwise, false.</returns>
 public bool RemoveBranch(MatchCaseBranch branch)
 {
     if (branch == null)
     {
         throw new ArgumentNullException("branch");
     }
     return branches.Remove(branch);
 }