Announcement Announcement Module
Collapse
No announcement yet.
Inner Class in C# ? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Inner Class in C# ?

    I have some small (i hope) problem. I try use inner class in C#.
    I have this simple code prepared for this post:

    class Outer
    {
    private int a;

    private Outer(int a)
    {
    this.a = a;
    }

    public class Inner
    {
    public Outer crateOuter(int a)
    {
    return new Outer(a);
    }
    }
    }

    This is code who use this:

    try
    {
    //this don't work:
    IApplicationContext spring = ContextRegistry.GetContext();
    Outer.Inner inner = spring["Inner"] as Outer.Inner ;

    //this work:
    Outer.Inner inner2 = new Outer.Inner();
    Outer o = inner2.crateOuter(0);
    }
    catch (Exception e)
    {
    MessageBox.Show(e.ToString());
    }

    this is my app-config file:

    <objects xmlns="http://www.springframework.net"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.net
    http://www.springframework.net/xsd/spring-objects.xsd">
    <object id="Inner" type="Practise.Outer$Inner"></object>
    </objects>

    and I have this error :

    Error creating context 'spring.root' : Coudent load type from string value "Practise.Outer$Inner".

    ofcourse assembly Practise.Outer is correct. problem is in inner class.
    Thanks for help.

  • #2
    Robert

    This is Spring Forum for Java

    This is Spring for .NET Community Forums

    Use code tags in the other side

    Comment


    • #3
      Thanks. it's good idea

      Comment


      • #4
        in C# counterpart for $ is +

        Comment

        Working...
        X