Categorizing class functions in groups
<p>Imagine a class as follows.. It's a class provided to me to work with.. I cannot change its source.. </p>

<pre><code>public class MyClass
{
    object _Object { get; set; }

    public void FuncA1() { _Object = new object(); }
    public void FuncA2() { _Object = new List&lt;object&gt;(); }

    public int FuncB1() { _Object = 0; return 0; }
    public int FuncB2() { _Object = 123; return 123; }

    public string FuncC1() { _Object = null; return null; }
    public string FuncC2() { _Object = "Hello"; return "Hello"; }
}
</code></pre>

<p>Im trying to create a wrapper for this class, such that I can group its many functions into categories..</p>

<pre><code>MyWrapper.Voids.FuncA1();
MyWrapper.Voids.FuncA2();
MyWrapper.Integers.FuncB1();
MyWrapper.Integers.FuncB2();
MyWrapper.Strings.FuncC1();
MyWrapper.Strings.FuncC2();
</code></pre>

<p>The only solution I can think of for this scenario is to design the wrapper like this:</p>

<pre><code>public class MyWrapper
{
    MyClass _Instance { get; set; }
    public _Void Voids { get; private set; }
    public _Integer Integers { get; private set; }
    public _String Strings { get; private set; }

    public class _Void
    {
        MyWrapper _Parent { get; set; }

        public void FuncA1() { _Parent._Instance.FuncA1(); }
        public int FuncA2() { return _Parent._Instance.FuncA2(); }
    }
    public class _Integer
    {
        ...
    }
    public class _String
    {
        ...
    }

    public MyWrapper()
    {
        _Instance = new MyClass();
        Voids = new _Voids(this);
        Integers = new _Integer(this);
        Strings = new _String(this);
    }
}
</code></pre>

<p>This solution works, but has a number of problems:
- The inner classes are forced to be public, which allows them to be instantiated by the user..
- I am forced to maintain a reference of the parent object in the child classes..</p>

<p>Is there a better way of doing this?</p>

<p>EDIT: The code posted initially was a bit confusing, in the sense that it was diverting attention away from the core issue and more into the issues of whether a function would cause exceptions or not if they all work on the same object..</p>

<p>NOTE: This is not actual code.. I hacked together this example to show what I'm trying to do.. CREATE A WRAPPER AROUND AN OBJECT (I cannot change the original object's code) AND GROUP FUNCTIONS INTO CATEGORIES..</p>

<p>FINAL EDIT: following suggestion by Juharr.. here's what ive done to accomplish what i wanted.. for the betterment of others..</p>

<pre><code>public interface IVoid
{
    void FuncA1();
    void FuncA2();
}
public interface IInteger
{
    int FuncB1();
    int FuncB2();
}
public class MyWrapper
{
    public MyClass Instance { get; private set; }
    public IVoid Voids { get; private set; }
    public IInteger Integers { get; private set; }

    private abstract class MyBase
    {
        protected MyWrapper Parent { get; set; }
        protected MyClass Instance { get { return Parent.Instance; } }
        public MyBase(MyWrapper oParent) { Parent = oParent; }
    }
    private class MyVoid : MyBase, IVoid
    {
        public MyVoids (MyWrapper oParent) : base(oParent) { }
        public void FuncA1() { Instance.FuncA1(); }
        public void FuncA2() { Instance.FuncA2(); }
    }
    private class MyInteger : MyBase, IInteger
    {
        public MyInteger (MyWrapper oParent) : base(oParent) { }
        public int FuncB1() { return Instance.FuncB1(); }
        public int FuncB2() { return Instance.FuncB2(); }
    }

    public MyWrapper()
    {
        Instance = new MyClass();
        Voids = new MyVoid(this);
        Integers = new MyInteger(this);
    }
}
</code></pre>
