Fetstil Fetstil Kursiv Understrykning linje färgläggning tabellverk Punktlista Nummerlista Vänster Centrerat högerställt Utfyllt Länk Bild htmlmode
  • Forum & Blog
    • Forum - översikt
      • .Net
        • asp.net generellt
        • c#
        • vb.net
        • f#
        • silverlight
        • microsoft surface
        • visual studio .net
      • databaser
        • sql-server
        • databaser
        • access
        • mysql
      • mjukvara klient
        • datorer och komponenter
        • nätverk, lan/wan
        • operativsystem
        • programvaror
        • säkerhet, inställningar
        • windows server
        • allmänt
        • crystal reports
        • exchange/outlook
        • microsoft office
      • mjukvara server
        • active directory
        • biztalk
        • exchange
        • linux
        • sharepoint
        • webbservers
        • sql server
      • appar (win/mobil)
      • programspråk
        • c++
        • delphi
        • java
        • quick basic
        • visual basic
      • scripting
        • asp 3.0
        • flash actionscript
        • html css
        • javascript
        • php
        • regular expresssion
        • xml
      • spel och grafik
        • DirectX
        • Spel och grafik
      • ledning
        • Arkitektur
        • Systemutveckling
        • krav och test
        • projektledning
        • ledningsfrågor
      • vb-sektioner
        • activeX
        • windows api
        • elektronik
        • internet
        • komponenter
        • nätverk
        • operativsystem
      • övriga forum
        • arbete karriär
        • erbjuda uppdrag och tjänster
        • juridiska frågor
        • köp och sälj
        • matematik och fysik
        • intern information
        • skrivklåda
        • webb-operatörer
    • Posta inlägg i forumet
    • Chatta med andra
  • Konto
    • Medlemssida
    • Byta lösenord
    • Bli bonsumedlem
    • iMail
  • Material
    • Tips & tricks
    • Artiklar
    • Programarkiv
  • JOBB
  • Student
    • Studentlicenser
  • KONTAKT
    • Om pellesoft
    • Grundare
    • Kontakta oss
    • Annonsering
    • Partners
    • Felanmälan
  • Logga in

Hem / Forum översikt / inlägg

Posta nytt inlägg


How to use class library when anthor class is used

Postades av 2006-03-20 11:02:04 - Tony Johansson, i forum c# (c-sharp), Tråden har 2 Kommentarer och lästs av 1068 personer

I'm trying to build a class library which has a class called
AvestaPlantFunc.
In this project building a class libray exist a class called
AvestaPlantFunc. In this class is there a method called IsBottomMixValid.
Code not relevant for the question has been removed.
This method IsBottomMixValid has one parameter and the type for this
parameter is MeltPracDataGmix meaning passing class reference
MeltPracDataGmix.

Now to my question the definition for class MeltPracDataGmix does not exist
in the same project as
the class AvestaPlantFunc. Class MeltPracDataGmix exist in another project
that build the exe file.

When a class has a reference to another class as in my example is it
nesessary that the full definition to class MeltPracDataGmix is existing in
the same project.

I assume if this was C++ it would be enough to include the class declaration
which is the header file and not the implementation.

But in C# we don't have any header files. So how do I do here?

What is the solution to this problem when the class need another class.


using System;
using MeltPracData;

namespace Common
{

public class AvestaPlantFunc
{
public bool IsBottomMixValid(MeltPracDataGmix mix)
{
//here is there some code
}
}
}

//Tony


Svara

Sv: How to use class library when anthor class is used

Postades av 2006-03-20 13:36:38 - Simon Dahlbacka

du sätter bara en referens till projektet där den andra klassen finns


Svara

Sv:How to use class library when anthor class is used

Postades av 2006-03-20 14:10:40 - Oskar Johansson

> du sätter bara en referens till projektet där den andra klassen finns

Translated to something like:
You add a reference to the project where you have your class.

If I understodd you correct, the class "MeltPracDataGmix" is found in your exe? If that's the case you have a few choices:
a) Move the class to a classlibrary that's _not_ depending on the classlib you have right now (or move your class to your current classlib?)
b) Use reflection (rellay ugly code, and bad performance, and trouble...)
c) Use interfaces. Create an interface containing the methods/properties you need from that class. Define the interface in your classlib. Then, let your class implement this interface (you need a reference from you exe to the classlib you have.) Your method then takes this interface as a parameter instead of the whole class.

I suggest method c) or a)


Svara

Nyligen

  • 09:09 Vill du köpa medicinska tester?
  • 12:47 Vem beviljar assistansen – kommune
  • 14:17 Någon med erfarenhet av hemstädnin
  • 14:14 Bör man använda sig av en båtförme
  • 14:12 Finns det någon intressant hundblo
  • 14:25 Tips på verktyg för att skapa QR-k
  • 14:23 Tips på verktyg för att skapa QR-k
  • 20:52 Fungerer innskuddsbonuser egentlig

Sidor

  • Hem
  • Bli bonusmedlem
  • Läs artiklar
  • Chatta med andra
  • Sök och erbjud jobb
  • Kontakta oss
  • Studentlicenser
  • Skriv en artikel

Statistik

Antal besökare:
Antal medlemmar:
Antal inlägg:
Online:
På chatten:
4 569 170
27 953
271 705
1 019
0

Kontakta oss

Frågor runt konsultation, rådgivning, uppdrag, rekrytering, annonsering och övriga ärenden. Ring: 0730-88 22 24 | pelle@pellesoft.se

© 1986-2013 PelleSoft AB. Last Build 4.1.7169.18070 (2019-08-18 10:02:21) 4.0.30319.42000
  • Om
  • Kontakta
  • Regler
  • Cookies