I have been trying to referenceClass library I have in a windows form application I am currently working on but it's not working! I created the DLL file by going to Projects > Build Solution and even tried using the Clean build and other misc options to create the DLL but nothing is working.After I add the DLL file as a reference in my Windows application, intellisense still won't recognise the
Code:
using ClassX
statement.I even made sure both programs target the same .NET 4.0 network.Does anyone have any idea of what could I be doing wrong?
Could you post the top several lines of your "ClassY" code. Including the namespace and the Class declaration?
ClassY
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Complex_Numbers
{
class Complex : IEquatable<Complex>
ClassX
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Deployment;
using Complex_Numbers;
namespace Control_System
{
It worked!!! Thank you very much!!! I can't believe it was just an easy fix.
It worked because a class needs to be marked as public in order to be accessed outside its assembly.
If you use that class inside an assembly, you can do so with it marked as public, private, or internal. Btw, declaring "class Complex" is the same as declaring "private class Complex".
If you need to access a class or other entity from a different assembly, then you need to mark it as public.
Bookmarks