草庐IT

class-library

全部标签

c# - VS 2015 中的类库 - 构建跨平台库

我可以在安装了Xamarin的VS2015中创建不同的类库:类库类库(Android)类库(包)类库(适用于通用应用程序的可移植)类库(可移植)类库(Xamarin.Forms)我很想知道两者之间的区别-只需简要说明即可:)场景我们的团队目前正在开发一个新项目,我们的目标是多个平台——主要是网络和移动(Xamarin)。虽然我们决定首先关注MVC网络应用程序,但我们希望创建一个包含所有模型和业务类(逻辑)的项目,以便以后可以在我们的项目中使用它。哪个类库最合适? 最佳答案 这个问题涉及面比较广,我尽量回答一下:类库输出DLL的标准.

c# - 控制台在类库 c# 中不可用

这个问题here似乎与我所经历的相反。我无法从新类库中访问控制台。我在顶部有usingSystem;。我在Windows8上使用visualstudio11。我怀疑这在更新中丢失了,所以这意味着我做错了什么。此外,一旦这一切正常,控制台是否可以在可移植类库中使用?编辑这里只是我做的一个测试文件usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;namespaceAdamLib.util.ConsoleSupport{classS

c# - 通过反射仅获取当前类(class)成员

假设这段代码:usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;usingSystem.Reflection;namespaceTestFunctionality{classProgram{staticvoidMain(string[]args){//System.Reflection.Assembly.GetExecutingAssembly().LocationAssemblyassembly=Assembly.LoadF

C#/N 休眠 : Association references unmapped class

几个小时以来,我一直在努力解决这个NHibernate问题。我在网络和NHibernate文档上进行了广泛的研究,但我无法理解这个问题。我对NHibernate比较陌生,但很喜欢它。不过,在那种情况下,它让我发疯。我正在为网站编写一个小型“投票”模块。我有几个类(Poll、PollVote和PollAnswer)。主要的Poll是导致问题的原因。这就是类的样子:publicclassPoll{publicvirtualintId{get;set;}publicvirtualSiteSite{get;set;}publicvirtualstringQuestion{get;set;}pu

c# - cs0030 :Unable to generate a temporary class

我有一个Web服务,当我尝试生成它的对象时出现以下错误。"Unabletogenerateatemporaryclass(result=1).errorCS0030:Cannotconverttype'ShortSell.ShortSellRQOriginDestinationInformationFlightSegment[]'to'ShortSell.ShortSellRQOriginDestinationInformationFlightSegment'errorCS0030:Cannotconverttype'ShortSell.ShortSellRSOriginDestina

c# - 在类库中找不到 ConfigurationManager

所以,我有一个类库,我知道它会被网站使用,我需要访问配置设置。我添加了对System.Configuration的引用,但在类库中找不到ConfigurationManager。有几件事,其中一件是当我添加对System.Configuration的引用时,它显示为带有小写字母“c”的“System.configuration”,我认为这很奇怪。另一件事,当我访问System.Configuration时,最接近ConfigurationManager的是“ConfigurationSettings”。我在允许我使用ConfigurationManager和此类库的Web应用程序中查看

c# - 公共(public)静态字符串 MyFunc() 上的 "Expected class, delegate, enum, interface or struct"错误。什么 's an alternative to "字符串”?

当我尝试使用以下静态函数时出现错误。错误:Expectedclass,delegate,enum,interface,orstruct函数(和类):namespaceMyNamespace{publicclassMyClass{//SomeotherstaticmethodsthatuseClasses,delegates,enums,interfaces,orstructspublicstaticstringMyFunc(stringmyVar){stringmyText=myVar;//DosomestuffwithmyTextandmyVarreturnmyText;}}}这导致

c# - OOPS 概念 : What is the difference in passing object reference to interface and creating class object in C#?

我有一个类CustomerNew和一个接口(interface)ICustomer:publicclassCustomerNew:ICustomer{publicvoidA(){MessageBox.Show("Classmethod");}voidICustomer.A(){MessageBox.Show("Interfacemethod");}publicvoidB(){MessageBox.Show("ClassMethod");}}publicinterfaceICustomer{voidA();}我对这两行代码很困惑。ICustomerobjnew=newCustomerNe

c# - c#中的类库是否有等效的Application_Start

我想在类库中从另一个程序集实例化时执行某些代码。类库是否有入口点或Bootstrap?我认为静态方法Main可以解决问题,但我错了。这方面的应用程序可能正在配置和实例化记录器单例、未处理的异常处理程序等。 最佳答案 图书馆本身并没有起点。当您实例化库的类时,您调用的第一条指令是类的构造函数(new)及其基构造函数(如果它们在构造函数定义中)。 关于c#-c#中的类库是否有等效的Application_Start,我们在StackOverflow上找到一个类似的问题:

c# - 在项目之间共享 DLL

Microsoft最近表示它是平台中立的,因此我尝试仅使用VSCode在Mac和Linux上构建并部署到Azure。为什么?主要是为了证明我可以。我们的项目有几个部分,包括几个不同的网站、一个WebAPI、erAPI和其他一些部分。在我的Mac上,我构建了一个.Net核心类库,其中包含大量对象。命令行、dotnet构建、DLL输出,没问题。我想将该DLL放在正在构建MVC网站的Linux机器上——希望这些对象构成该网站的模型部分。我不知道如何让网站项目引用我的DLL并使用这些对象。我假设我将它复制到另一台机器,将它放在正在开发的站点的bin文件夹中,并在该站点的project.json