Click here to Skip to main content
11,644,731 members (61,246 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#3.0 ASP.NET C#4.0
Hi

how to expose members of my class library(.dll) to my web application Asp.net.

i build a class library and this lib was added to my web application as a reference. But know, i want my web application to access my lib(.dll class) properties but not the methods of my .dll

so please tell me what i have do in my class lib (.dll) so that i will expose only members (properties) but not it methods.


Thanks & Regards
chiranjeevi Ommi

[edit]Code moved from Solution to question - OriginalGriff[/edit]

Hi

i am getting error, if i change them to private.

i will past my sample code here, pls help me hoe to do it.

*****************************

   namespace TestDLL
    {
        
        Public sealed class A
        {
            private static volatile A instance = null;
            private static object myLock = new object();
            public B siteConfig = null;
    
            private A()
            {
                objB = new B();
                objB.ReadXml();
            }
    
            public static A Instance
            {
                get
                {
                    if (instance == null)
                    {
                        lock (myLock)
                        {
                            if (instance == null)
                            {
                                instance = new A();
                            }
                        }
                    }
                    return instance;
                }
            }
        }
        
        Public class B
        {
            private string virP = string.Empty;
            private string rootP = string.Empty;
            private string conP = string.Empty;
            
            public string VirP
            {
                get { return vir; }
                set { virP = value; }
            }
            public string ConP
            {
                get { return conP; }
                set { conP = value; }
            }
            public string RootP
            {
                get { return rootP; }
                set { rootP = value; }
            }
            
            public void ReadXML()
            {
            virP="";
            ConP="";
            RootP="";
            
        }
    }
 
}


**************************


when i add my DLL to my web application, i should see only VirP,ConP and RootP but the method "ReadXML". which is not happening even i change to Private.

Thanks & Regards
Chiranjeevi
Improve solution Permalink | Posted 9 mins ago
ommi.chiru724
Posted 28-Sep-12 22:03pm
Edited 28-Sep-12 22:44pm
v2
Comments
ommi.chiru at 29-Sep-12 4:35am
   
I pasted my code in second solution "2 Solution" . Please help me how i can expose only elements (properties) but not the methods of my dll.

Thanks & Regards
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Make them private instead of public
  Permalink  
Comments
ommi.chiru at 29-Sep-12 4:36am
   
Hi

I pasted my code in second solution "2 Solution" . Please help me how i can expose only elements (properties) but not the methods of my dll.

Thanks & Regards
chiranjeevi
OriginalGriff at 29-Sep-12 4:45am
   
Change them to Internal rather than private then - but only the necessary ones!

This means they will only be available within the same assembly.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

try "internal" access modifier instead of "private".
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 680
1 jyo.net 494
2 Sergey Alexandrovich Kryukov 464
3 Afzaal Ahmad Zeeshan 404
4 CPallini 386
0 OriginalGriff 1,020
1 Sergey Alexandrovich Kryukov 673
2 DamithSL 656
3 Afzaal Ahmad Zeeshan 652
4 CPallini 555


Advertise | Privacy | Mobile
Web03 | 2.8.150731.1 | Last Updated 29 Sep 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100