class-library

Need a C# Assembly to reference a strongly named assembly loosely.

So here's the problem. I'm writing some StyleCop plug-in assemblies for use at the company I work for. As such, these assemblies need to reference Microsoft.StyleCop.CSharp.dll for example, which is strongly named. The problem comes in that if I build this and pass it along to the developers in my group, they must have the same versio...

Visual Studio C#: Why is a "using" directive insufficient for some libraries?

Scenario: I needed to add HttpUtility to my project, and I started by adding "using System.Web" to my collection of using directives. However the HttpUtility class would still not resolve, and I discovered (via this question) that I needed to add a reference to my project. Question: Why do I need to add a reference to this library when ...

Extension methods in class library project

I've implemented some extension methods and put those in separate Class Library project. Imagine I have a simple extension method like this in class library called MD.Utility: namespace MD.Utility { public static class ExtenMethods { public static bool IsValidEmailAddress(this string s) { Regex regex...

c# - what would be the best way to package/abstract a topology map API with persistance?

Hi, Background - I'm looking to create a reusable library that allows one to work with a topology map of data. That is data that consists of nodes and relationships between them. The API's would include methods such as "find all children" for which the method would have to "walk the tree" and find all the nodes under this one etc. The...

Pass Session data to a Class Library without using a bunch of constructors?

Hi all, I've got my application here where literally every object has a lastUpdatedBy property. The information I put into here is the person's username, which is retrieved from the session("username") variable. How can I pass this data to my DAL in the class library? At first I was just passing in the value into each method, but thi...

Mercurial: Class library that will exist for both .NET 3.5 and 4.0?

I have a rather big class library written in .NET 3.5 that I'd like to upgrade to make available for .NET 4.0 as well. In that process, I will rip out a lot of old junk, and rewrite some code to better take advantage of the new classes and support in .NET 4.0 (like TPL.) The class libraries will thus diverge, but still be similar enough...

Asp.net project is not recognising one of the folders in my class library.

I am developing a project using Visual Studio 2008 in C#, I have added the class library within the project and set up the relevant references and used the relevant using statements. It seems to be a problem with just this one folder. can anyone help? this is the error message: Error 28 The type or namespace name 'Domain' does no...

How to re-use ASP.NET .aspx or .ascx files?

Hi all, I know if someone wnats to re-use some classes (not UI), he must gather all of them and put in a Visual Studio Class Library, build it to some dells and distribute thoese dlls. In this approach there just one code, you just update code in one place. But what about ASP.NET's markups? For exmaple you have an .ascx file or a colle...

Why is this class library dll not getting information from app.config

I am developing a custom HttpHandler, to do so I write a C# Class Library and compile to DLL. As part of this I have some directory locations which I want not hard coded in the app, so i'm trying to put it in the app.config which I've used before. Before this has worked by just going building the app.config: <?xml version="1.0" encodi...

Is ASP.NET membership, role management and Profile usable in a C# Class Library?

I know it's possible to use this information in a winform, wpf or console application. But I rather to determine which user with what roles are running a sepecific method, so I could decide upon them and run different codes. In addition in a desktop app. how a user can login? Is there any special winform or wpf login control? ...

Having trouble debugging class library plugin

Hi all. I have a windows form application in which I'm attempting to utilize a plugin (class library). In the code I have it load the assembly from a dll file, which means I have not been able to debug. Furthermore I have not found out how to compile the library so I've had to use the debuged dll version for testing. I've run into a bug ...

Can I use System.Web.Mvc from a Class Library?

I'm working on an ASP.NET MVC application, but I'm trying to remove everything but Controller code from my project and put it in it's own Class Library. I've got some code that is Using System.Web.Mvc; But it doesn't seem to be letting me access it. I have Referenced the System.Web Namespace in the project. Bassically I'm gettin...

Different configuration settings per developer for c# class library

Hello, We're a small team, working on a asp.net web project, as well as service, both projects dependent on a shared class library. We'd like to have the class library settings different per developer (and later on for production). In settings are included sensitive information, such as passwords, as well as hostnames. How should we a...

Does java have a class that represents a timer?

I'd like a timer class that allows me to call: .start()   .getElapsedTime()   .stop()   .reset() Does Java have such a class, or do I need to use my own (which I've already written). From a best-practice point of view, I should use the Java class libraries classes if they exist, but I'm not sure whether this one does. Can anyone give...

Using ASP.Net MVC Data Annotation outside of MVC

Hi there, i was wondering if there is a way to use ASP.Net's Data annotation without the MVC site. My example is that i have a class that once created needs to be validated, or will throw an error. I like the data annotations method, instead of a bunch of if blocks fired by the initaliser. Is there a way to get this to work? I though...

.NET - Storing An App.config With A Class Library

This seems to be asked a lot on the internet, but so far my research hasn't produced a solution. (And, at least for now, I haven't accepted "it can't be done" as a solution.) At its simplest description, what I'm trying to do is have a config file in a .NET class library project that is available to that class library in any applicatio...

C# Remoting classes organization

Hi, I'm developing a Remoting classes library so that I can keep database interaction and business object on the server and not on clients. I'd like to be able to return my own objects to the clients so that they can interact with them through the server itself. For example (semi-pseudocode): Server class Database { ... } class Utili...

How to Decide when to Implement a DLL?

At which point do you decide that some of your subroutines and common code should be placed in a class library or DLL? In one of my applications, I would like to share some of my common code between different projects (as we all know, it's a programming sin to duplicate code). The vast majority of my code is all within a single project....

Class Library in C#

I tried to create a class library that is being used in a winforms application in C#. In my application I have input from a textbox and through a button click I'm instantiating my event with one parameter (from the textbox). I tried to create a constructor with this one parameter - but to no avail. It seems if I just add a class to be ...

Problem with Constructors

*Just below is my winform client inst with one parameter constructor within the class.* private void button1_Click(object sender, EventArgs e) { string s1 = textBox1.Text; int x1 = Convert.ToInt32(s1); int X= x1; ExternalTest ob = new ExternalTest(X); string s2 =...