0

I have a business requirement where my front-end mule passes me "an array containing a maximum of 10 rows, with each row containing a name and a image byte stream"

I researched and found we can create variables like below:

Byte[] m = new Byte[9]

String name = string.empty;

I want something like:

Input[9,9] g = new Input[9,9];

My data for g looks like:

g = {{ hehhdh0474637, test1}, { gsgsgh376,test2}... upto 9}

I’m a business analyst but doing some coding to meet my company's software requirements, so apologies if it’s a silly question -- but that’s what I want to achieve

1
  • Is it possible each row containing a name and a image byte stream means an object with 2 properties, one for a name as a string and one is a byte array? Commented Jan 31, 2019 at 22:34

1 Answer 1

1

Your questions is a little vague, but I'll give it a go.

I think what you want is something called a Dictionary

Then you would declare it as follows:

Dictionary<string, Byte[]> inputs = 
            new Dictionary<string, Byte[]>();

You could then add key/value pairs to your dictionary like so:

inputs.Add(name, m);

You can then read / update from the dictionary with Array style syntax:

inputs[name] = m[x];
Sign up to request clarification or add additional context in comments.

3 Comments

Kyle thank you so much, I think we are nailing down. I can receive upto 10 items for this. One more quick help, can you please help with how to add to this dictionary win say sample2 array of bytes and it’s name...also, once added, how would I assign to individual properties of bytes and string name both would be list I think or again array...please help with same 2 rows ?
Kyle, thank you, only your declaration is understandable for me. I dont understand other two statements or sntax...can you explain with a data for looping and reading and assigning it to individual variables
The question is a bit too vague for me to really any write more expansive code. The Microsoft doc I linked lays out all the ways you can use a Dictionary pretty well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.