title: Does C# have any kind of delegate-esque feature I can use for a type instead of a method?
body: <p>I'm writing a permissions service for my app, and part of this service's responsibility is to check that a user has permission to access the particular object they are trying to change. There are around 6 six different objects that can be mutated, and they all possess a particular property called <code>tenant</code>. This tenant prop is what I need to check.</p>
  
  <p>The issue is that I want to keep my code as DRY as possible, but I can't see anyway of not repeating myself in this particular situation. I have six different objects which I need to check, therefore I have six different IDs and six different calls to the database to retrieve the information I need.</p>
  
  <p>I'm reluctant to write six different methods each supporting the different objects I need to check, but since the code is going to look something like the below (vastly simplified) I'm not sure if there's anything I can do differently.</p>
  
  <pre><code>public bool CheckUserHasPermissionForObject(string id)
          {
  
              var obj = _dataRepository.GetObjById(id);
              var userHasPermission = UserHasPermission(obj);
              return userHasPermission;
          }
  </code></pre>
  
  <p>I was hoping delegate types would lend a hand here but I don't think they'll help either. </p>