Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > kSharp - adding elements to lists after list creation - how?? View modes: 
User avatar
Member
Member
simon - 8/23/2012 1:00:18 AM
   
kSharp - adding elements to lists after list creation - how??
Hello,

K Sharp Documentation says that I can create a variable of IList, but when i try to add values to it nothing happens.

eg :

{%

parent = CurrentDocument.Parent;
list = List( parent );

return list;

%}

prints nothing.

I need to walk up the tree getting a value from the parent document type, reverse the order of the values and then print it out, but first step is figuring out how to create the list to store the values in.

I know I can do this in ASP.net, but would like to do more kSharp in my projects as it makes syncing so much easier.

User avatar
Kentico Support
Kentico Support
kentico_janh - 8/23/2012 3:37:29 AM
   
RE:kSharp - adding elements to lists after list creation - how??
Hello,

K# is a weak type language so it ignores type definitions like List. Your example would work the same without that definition:

{%
parent = CurrentDocument.Parent;
list = parent;
return list;
%}


Best regards,
Jan Hermann