0
var parentstl = from parentstyle in DBB.vParentStyles
select new {   parentstyle.name,
               parentstyle.description,
               parentstyle.price,
               parentstyle.categories
           };

I want parentstyle.categories to convert into int[] array.

How can I do that?

2
  • 2
    What is parentstyle.categories? Objects or ints? Commented Jul 28, 2014 at 18:16
  • What is DBB.vParentStyles? Is it a dataset from Entity Framework? Also what is parentstyle.categories? Commented Jul 28, 2014 at 18:16

1 Answer 1

2

You can use Select to make projections, like this:

var parentstl = from parentstyle in DBB.vParentStyles
select new {
    parentstyle.name,
    parentstyle.description,
    parentstyle.price,
    Categories = parentstyle.categories.ToArray()
 };
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks. I am new to C#. Now I want to serialize this data into jason format. Below is my code.
@user3817564 The code did not show up in the comment. You would be better off asking a separate question for serialization, though - it would help to have more eyes looking at the issue. If you would like to give readers of the new question some additional context, you could reference this question inside the new one.

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.