This is a discussion on Restricting the scope of a method within the C# Programming forums, part of the Software Development category; Is it possible to restrict the scope of a field/method of a class to the classes in the same ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| hi, yes, it is possible to restrict by using "private-access specifier" eg: namespace Test { public partial class ClassTest { public void callme() { } private void callme1() { } } } in another class in the same namespace using Test namespace Test { public partial class ClassTest1 { public void Tocall() { ClassTest obj=new ClassTest(); //here you can access the public function callme() using this object, // but you can't call callme1() } } } Regards Manivannan.s |
| |||
| Hi Mani and Sathish, There is no way to restrict to a namespace. Namespaces are never units of protection. But if you’re using assemblies, you can use the ‘internal’ access modifier to restrict access to only within the assembly. |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Scope of testing?? | ammulu | Software Testing | 3 | 01-10-2008 11:27 AM |
| Scope Trouble while calling Functions | aramesh | Flash Actionscript Programming | 1 | 12-14-2007 05:29 AM |
| scope variable | itbarota | HTML, CSS and Javascript Coding Techniques | 1 | 11-13-2007 12:29 AM |
| What is Variable Scope in PHP? | itbarota | PHP Programming | 1 | 10-25-2007 03:23 AM |
| Transaction Scope in DotNet using C#. | S.Vinothkumar | C# Programming | 52 | 09-22-2007 01:15 AM |