This handles some special cases for reference links in .NET

        First, the standard Sphinx reference syntax of ``:ref:`Title<Link>```,
        where a reference to ``Link`` is created with title ``Title``, causes
        problems for the generic .NET syntax of ``:dn:cls:`FooBar<T>```. So, here
        we assume that ``<T>`` was the generic declaration, and fix the
        reference.

        This also uses :py:cls:`AnyXRefRole` to add `ref_context` onto the
        refnode. Add data there that you need it on refnodes.

        This method also resolves special reference operators ``~`` and ``.``

def process_link(self, env, refnode, has_explicit_title, title, target):
        """This handles some special cases for reference links in .NET

        First, the standard Sphinx reference syntax of ``:ref:`Title<Link>```,
        where a reference to ``Link`` is created with title ``Title``, causes
        problems for the generic .NET syntax of ``:dn:cls:`FooBar<T>```. So, here
        we assume that ``<T>`` was the generic declaration, and fix the
        reference.

        This also uses :py:cls:`AnyXRefRole` to add `ref_context` onto the
        refnode. Add data there that you need it on refnodes.

        This method also resolves special reference operators ``~`` and ``.``
        """
        result = super(DotNetXRefRole, self).process_link(env, refnode,
                                                          has_explicit_title,
                                                          title, target)
        (title, target) = result
        if not has_explicit_title:
            # If the first character is a tilde, don't display the parent name
            title = title.lstrip('.')
            target = target.lstrip('~')
            if title[0:1] == '~':
                title = title[1:]
                dot = title.rfind('.')
                if dot != -1:
                    title = title[dot + 1:]
        else:
            if title != target:
                target = title = '{title}<{target}>'.format(title=title,
                                                            target=target)
        return title, target