C# - 编译器错误 [英] C# - Compiler error

查看:54
本文介绍了C# - 编译器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Mono 在 C# 中创建一个应用程序,并且我正在引用两个给我一个错误的库.我怎样才能做到这一点,以便我只引用一个.

I am making an app in C# using Mono and I am referencing two libraries which is giving me an error. How can I mae it so that i only reference one.

这是我遇到的错误

Error 1 The type 'System.Drawing.RectangleF' 存在于 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v2.3\Mono.Android.dll' 和'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoTouch\v4.0\monotouch.dll' C:\Users\cmtc\documents\visual studio 2012\Projects\BoostITAndroid\BoostITAndroid\HelperClasses\RightAlignedEntryElement.cs 19 50 BoostITAndroid

我该如何制作,所以我只从其中一个库中选择 System.Drawing.RectangleF

how do I make it so I only select System.Drawing.RectangleF from one of the libraries

推荐答案

使用别名引用:

using Name1 = Android.Mono;
using Name2 = Monotouch;

无论您在哪里使用引用,请使用您想要使用的别名;

Wherever you are using the reference, use the alias name that you wanted to use, for example;

Name1.RectangleF rectF = new Name1.RectangleF();

这样你就可以保留两个参考.

This way you keep both reference.

这篇关于C# - 编译器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆