Jump to content

A question on List I was not able to find on google or maybe I'm missing something.


Reptillian

Recommended Posts

Here's the problem I have. How to add to Image_Rect list?

 

List<(int,int,int,int,int)> Image_Rect = new List<(int,int,int,int,int)>();
Image_Rect.Add(Tuple((100,0,100,0,5)));

The above don't work.

 

What I'm trying to do is create 2 set of dynamic array of fixed size array of size 5, and to be able to access each variable at index n and to remove at index n. In addition to that, I would like to be able to use functions on it to replace the n index. Any idea?

Edited by Reptillian

G'MIC Filter Developer

Link to comment
Share on other sites

  • Reptillian changed the title to A question on List I was not able to find on google or maybe I'm missing something.

For both, I get errors.

 

Invalid token '(' in class, record, struct, or interface member declaration
Type expected
Tuple must contain at least two elements.
) expected
Tuple must contain at least two elements.
) expected
Invalid token '100' in class, record, struct, or interface member declaration

 

G'MIC Filter Developer

Link to comment
Share on other sites

This code works for me; no errors.

List<(int,int,int,int,int)> Image_Rect = new List<(int,int,int,int,int)>();
Image_Rect.Add((100,0,100,0,5));

 

Are you using an old version of Visual Studio? Like 2017, or even an old build of 2019?

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

Link to comment
Share on other sites

2 minutes ago, toe_head2001 said:

This code works for me; no errors.

List<(int,int,int,int,int)> Image_Rect = new List<(int,int,int,int,int)>();
Image_Rect.Add((100,0,100,0,5));

 

Are you using an old version of Visual Studio? Like 2017, or even an old build of 2019?

 

CodeLab 6.3 actually.

G'MIC Filter Developer

Link to comment
Share on other sites

Your code is directly in the class body. That will never work. Try putting it within a code block, such as Render() or PreRender().

 

Or, if it must be initialized directly in the class body for whatever reason, it can be written like this:

List<(int,int,int,int,int)> Image_Rect = new List<(int,int,int,int,int)>
{
    (100,0,100,0,5)
};

 

  • Like 1

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...