1

I read this somewhere, and i was just trying to figure out, what this does. I know it is a LINQ query, but ater the 'in clause', i see some text, which i am unable to understand, Usually, we write a table name here or some source like array/generics. can anyone please explain me.

var youShould = from c
  in "3%.$@9/52@2%35-%@4/@./3,!#+%23 !2#526%N#/-"
  select (char)(c^3<<5);

The value in the youShould should be some char value, but i am unable to figure out exactly.

1 Answer 1

2

"3%.$@9/52@2%35-%@4/@./3,!#+%23 !2#526%N#/-" is just a string and the LINQ query iterates over its characters.

The select applies a bitwise exclusive-OR and some bit shifting. It outputs a enumerable containing some characters. When you call this:

Console.WriteLine(youShould.ToArray());

You will see the actual message.

Sign up to request clarification or add additional context in comments.

3 Comments

can u pls explain the o/p ?
In classic C a string was just a array of chars, this is nothing else. If you want to know what c^3<<5 does, please visit msdn.microsoft.com/en-us/library/6a71f45d.aspx
@user3718715: Need more thoughts to explain this code?

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.