c# - 如何在 2 个不同的 DLL 中访问具有相同完全限定名称的类型

标签 c# .net wpf dll datagrid

我需要引用程序集 PresentationFramework.ClassicPresentationFramework.Luna 并且我遇到了需要使用 Microsoft.Windows 的情况。 Themes.DataGridHeaderBorder 类型。但这会产生错误,因为两个程序集都定义了这种类型。 我的意思是,我可以为这种类型引用它们中的任何一个(Classic 或 Luna),它只是一个简单的 Datagrid,我需要在其中检查 DataGridHeaderBorder 是否被单击。

提前致谢。

最佳答案

试试这个:

using Clasic = PresentationFramework.Classic;
using Luna = PresentationFramework.Luna;



namespace Test1
{
    class Program
    {
        static void Main(string[] args)
        {
            Clasic.Microsoft.Windows.Themes.DataGridHeaderBorder bClassic;
            Luna.Microsoft.Windows.Themes.DataGridHeaderBorder bLuna;
        }
    }
}

关于c# - 如何在 2 个不同的 DLL 中访问具有相同完全限定名称的类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9264155/

相关文章:

c# - 为什么 AddRange 比使用 foreach 循环更快?

c# - 当我按下按钮组合框值不显示

c# - 如何覆盖 ToString() 并实现泛型?

c# - 使用 Entity Framework 从数据库中检索数据

c# - 发送邮件表单异常 : System. Runtime.InteropServices.COMException : ? ?? ?????? "SendUsing"???? ?÷?

c# - 检测对 BindingSource/BindingList 的更改

.net - 什么时候应该使用静态 IoC 容器?

wpf - 调整 XAML Grid.Background 图像的大小

c# - Relaycommand ICommand.CanExecute 不触发

c# - WCF 客户端返回空数组 - XML 响应似乎正常