.NET Logo
Welcome Guest Search | Active Topics | Members | Log In | Register

สอบถามการเรียกใช้ Dll ที่ได้สร้างขึ้นมาจาก Project อื่น ครับ Options · View
forsiam
Posted: Monday, October 06, 2008 2:13:47 PM
Rank: มือฝึกหัด
Groups: Member

Joined: 9/12/2008
Posts: 7

สอบถามการเรียกใช้ Dll ที่ได้สร้างขึ้นมาจาก Project อื่น ครับ

 Code ที่อยู่ใน SSSUtility.dll นะครับ

using System;
using System.Collections.Generic;
using System.Text;

namespace SSSUtility
{
    class Test
    {
        public Test() { }

        public int plus(int a, int b)
        {
            return a + b;
        }
    }
}
 

ตอนทดสอบ ก็สร้าง project ใหม่ เป็นแบบ console ทำการ Add Reference เลือกไฟล์ SSSUtility.dll เข้ามา

Code ทดสอบ

using System;
using System.Runtime.InteropServices;
using SSSUtility;

namespace TestApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            SSSUtility.Test a = new SSSUtility.Test();

        }
    }
}

 

ปรากฏว่า มี Error แจ้งว่า " 'SSSUtility.Test' is inaccessible due to its protection level";

ไม่ทราบว่า จะเรียกใช้ Dll อย่างไรได้บ้างครับ ขอบคุณครับ

 

mrxc
Posted: Monday, October 06, 2008 2:46:48 PM
Rank: มือเทพ
Groups: Member

Joined: 3/6/2008
Posts: 177
Location: TH

อล้งเปลี่ยนเป็น public class Test

forsiam
Posted: Monday, October 06, 2008 4:38:29 PM
Rank: มือฝึกหัด
Groups: Member

Joined: 9/12/2008
Posts: 7

ขอบคุณครับ

ลืมใส่ public สนิท

Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

YAFVision Theme Created by Jaben Cargman (Tiny Gecko)
Powered by Yet Another Forum.net version 1.9.1.8 (NET v2.0) - 3/29/2008
Copyright © 2003-2008 Yet Another Forum.net. All rights reserved.


Sponsored by