One more C# WPF to Cobol

here is the c# Code:

List<string> options = new List<string>()

((CollectionViewSource)this.FindResource("cvsOptions")).Source = options

List<WPFGridZeilen> GridList = new List<WPFGridZeilen>()

What is it in Cobol ?

 

 

  • Hi Bernd, there is a generics sample included in the product that is worthwhile looking through.

    Start the Samples browser from the start menu

    Select the COBOL for .NET section

    Select Generics subsection

    The first sample in the solution shows how to use a generic list of strings.

    Also take a look at the Collections sample.

  • ok, this helps a Little bit but i Need this lines too:

    ((CollectionViewSource)this.FindResource("cvsOptions")).Source = options

     List<WPFGridZeilen> GridList = new List<WPFGridZeilen>()

  • For more Background:

    This is in the WPF:

    ...

           <CollectionViewSource x:Key="cvsOptions"/>

    ...

    This line is in c#:

    ...

    ((CollectionViewSource)this.FindResource("cvsOptions")).Source = Options

    ...

  • For more Background:

    This is in the WPF:

    ...

           <CollectionViewSource x:Key="cvsOptions"/>

    ...

    This line is in c#:

    ...

    ((CollectionViewSource)this.FindResource("cvsOptions")).Source = Options

    ...

  • This is not right...

             set ((CollectionViewSource)this.FindResource("cvsOptions")).Source to strings

  • this is wrong too:

              set ((CollectionViewSource)this::FindResource("cvsOptions"))::Source to strings

    The complier have problems wit the first "(" ...

  • Hi Bernd, casts are done in COBOL using the syntax AS type-specifier.  I've created the following to demonstrate how this might be written in COBOL.  The three lines in method m, correspond to the original three C# lines, the rest is just framework around them...

         $set ilref"presentationframework.dll"

         $set ilusing"System.Windows.Data"

          class-id a.

          method-id m.

              declare options as list[string]

              set self::FindResource("cvsOptions") as type CollectionViewSource::Source to options

              declare GridList as list[type WPFGridZeilen]

          end method.

          method-id FindResource.

          procedure division using by value s as string

                             returning ret as type CollectionViewSource.

              set ret to null

          end method.

          end class.

          class-id WPFGridZeilen.

          end class.

  • The Compiler do something wrong...

         *    ((CollectionViewSource)this.FindResource("cvsOptions")).Source = options

             declare options as list[string]

    After this Line;

             set self::FindResource("cvsOptions") as type CollectionViewSource::Source to options

    The Compiler goes back to the WPF AND Not to the next Line!?

    This is the next Line:      

         *      List<WPFGridZeilen> GridList = new List<WPFGridZeilen>()

             declare GridList as list[type WPFGridZeilen]

  • The Compiler do something wrong...

         *    ((CollectionViewSource)this.FindResource("cvsOptions")).Source = options

             declare options as list[string]

    After this Line;

             set self::FindResource("cvsOptions") as type CollectionViewSource::Source to options

    The Compiler goes back to the WPF AND Not to the next Line!?

    This is the next Line:      

         *      List<WPFGridZeilen> GridList = new List<WPFGridZeilen>()

             declare GridList as list[type WPFGridZeilen]

  • Not sure I fully understand the question, but in my last post I did omit the actual construction of the list.  This can be done either using our portable collections syntax:

             declare GridList as list[type WPFGridZeilen]

            create GridList

    ...or by using a standard 'new' (constructor) expression:

             declare GridList as list[type WPFGridZeilen] = new List[type WPFGridZeilen]