class-library

Console unavailable in class library c#

蹲街弑〆低调 提交于 2019-12-04 00:38:09
This question here seems contrary to what I have experienced. I cannot access the console from within a new class library. I have using System; at the top. I am using visual studio 11 on windows 8. I doubt that this has been lost in the update, so that means that I am doing something wrong. Also, once this is working, is the console available in a portable class library? EDIT here is just a test file I made using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace AdamLib.util.ConsoleSupport { class SafeRead { private void

How to read connection string inside .NET Standard Class library project from ASP.NET Core

牧云@^-^@ 提交于 2019-12-03 21:49:18
In my solution, I have a ASP.NET Core web project and a .NET Standard class library project. Class library project is the data access layer and I want to read the connection string from my appsettings.json (ASP.NET Core project) in my data access layer. I have found few answers such as by Andrii Litvinov which looks like quite straight forward to implement but he also mentioned about implementing through Dependency Injection. I don't want to choose the easy shortcut way but looking for the dependency injection implementation? I am not sure if having appsettings.json in my class library and

Class libraries in VS 2015 - Building Cross Platform Libraries

我的未来我决定 提交于 2019-12-03 16:34:32
问题 There are different class libraries I can create in VS 2015 with Xamarin installed: Class Library Class Library (Android) Class Library (Package) Class Library (Portable for Universal Apps) Class Library (Portable) Class Library (Xamarin.Forms) I would love to know the difference between each - just a brief would do :) The Scenario Our team is currently developing a new project which we are targeting for multiple platforms - web and mobile (Xamarin) primarily. While we decided to focus on the

How can I call C# extension methods in VB code

北城以北 提交于 2019-12-03 12:08:35
I have a class library with some extension methods written in C# and an old website written in VB. I want to call my extension methods from the VB code but they don't appear in intelisense and I get compile errors when I visit the site. I have got all the required Import s because other classes contained in the same namespaces are appearing fine in Intelisense. Any suggestions EDIT: More info to help with some comments. my implementation looks like this //C# code compiled as DLL namespace x.y { public static class z { public static string q (this string s){ return s + " " + s; } } } and my

When is it the right time to use C# class library (.dll)?

天大地大妈咪最大 提交于 2019-12-03 11:39:46
问题 I'm a programmer who has never really used .dll files. Of cause, when I need 3rd party software, such as a graphics library, a library to help me create graphs etc. I do add the references/ddl files to my program and use them in my code. Also, it seems like you can use .dll for a lot of different things, so I'd like the topic to concentrate on C#. Right now I am working on a sanitizing library(?) (I think that is the correct term), which will be full of relevant methods that can sanitize

WCF Service Library vs Class Library project types

久未见 提交于 2019-12-03 09:38:39
What does a WCF Service Library do that a regular class library doesn't? Edit: I posted my own answer. Am I missing anything? Are they fundamentally both just class libraries with a few template classes added? I created both and compared. This is what I found. WCF Service Library adds references to System.Runtime.Serialization and System.ServiceModel . does not contain a reference to System.Data.DataSetExtensions as the Class Library does. contains sample service classes IService1 , CompositeType and Service1 adds app.config with a wsHttpBinding and a mexHttpBinding service endpoint adds

How to load views from a Class Library project?

南楼画角 提交于 2019-12-03 06:32:55
I tried to create a VirtualPathProvider and set the view as an embedded resource. class AssemblyResourceVirtualFile : VirtualFile { string path; public AssemblyResourceVirtualFile(string virtualPath) : base(virtualPath) { path = VirtualPathUtility.ToAppRelative(virtualPath); } public override System.IO.Stream Open() { string[] parts = path.Split('/'); string assemblyName = parts[2]; string resourceName = parts[3]; assemblyName = Path.Combine(HttpRuntime.BinDirectory, assemblyName); var assembly = Assembly.LoadFile(assemblyName); if (assembly != null) { return assembly.GetManifestResourceStream

Class libraries in VS 2015 - Building Cross Platform Libraries

怎甘沉沦 提交于 2019-12-03 05:55:11
There are different class libraries I can create in VS 2015 with Xamarin installed: Class Library Class Library (Android) Class Library (Package) Class Library (Portable for Universal Apps) Class Library (Portable) Class Library (Xamarin.Forms) I would love to know the difference between each - just a brief would do :) The Scenario Our team is currently developing a new project which we are targeting for multiple platforms - web and mobile (Xamarin) primarily. While we decided to focus on the MVC web app first, we want to create a single project to contain all models and business classes

.net load configuration in class library

我是研究僧i 提交于 2019-12-02 14:42:47
问题 let's say i have : 1) 1 WindowsForm on "A" Project 2) 1 WindowsForm on "B" Project 3) 1 class library (GAC) Condition Both of Project references is same Part 1 : I have my.settings in my class library to save configuration with public function Part 2 : I create value/configuration from "A" and store it in my class library. settings has been successfully saved, and load the value/configuration with no errors Question : 1). Why i can't load the value/configuration from "B" ? NullException shown

Overriding methods values in App.xaml.cs

安稳与你 提交于 2019-12-02 12:59:51
问题 I am working on Windows 8 Phone application,I have 2 things here one is Library project and other is normal app,Let me first explain my code: In Library project class A { public static string empName ="ABC"; public static int empID = 123; public virtual List<string> ListOfEmployees() { List<string> empList = new List<string> empList.Add("Adam"); empList.Add("Eve"); return empList; } } I have referenced the library project in my child project, My child and Library project are in 2 different