79834579

Date: 2025-12-01 09:40:12
Score: 1
Natty:
Report link

thanks for your Replies!

The background of this question is, that I have code which has a semaphoreslim which should be released after the specific code runs.

And then it occurred to me, what happens if, for example, you return an integer. But yes, that's something else. Thank you very much for clarifying that! :)

Here is a snippet of my code.

public virtual VcsStatus GetStatus(string path)
{
    _semaphore.Wait();
    try
    {
        path = _resolvePath(path);
        Collection<SvnStatusEventArgs> statusItems;

        if (!_svnClient.GetStatus(path, out statusItems))
            throw new SvnException($"SVN status failed for path: {path}");

        List<VcsFileChange> changes = [];

        foreach (SvnStatusEventArgs item in statusItems)
        {
            if (item.LocalContentStatus == SvnStatus.Normal && item.LocalPropertyStatus == SvnStatus.Normal)
                continue;

            changes.Add(new VcsFileChange(
                path: item.Path,
                oldPath: item.MovedFrom,
                changeType: _mapChangeType(item.LocalContentStatus)
            ));
        }

        return new VcsStatus { FileChanges = changes };
    }
    finally
    {
        _ = _semaphore.Release();
    }
}
Reasons:
  • Blacklisted phrase (0.5): Thank you
  • Blacklisted phrase (0.5): thanks
  • Long answer (-1):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Colin