Avatar of ghj Grandhe
ghj Grandhe

asked on 

checking sequence of numbers through byte array in c#

Actually i need to check the sequence of elements in an byte array in c#
where here "d" and "q" are character arrays.

here the below 2 lines are converting it into byte[]
iam getting error at    "if((item)==p.Contains(Convert.ToInt32(item)+1))"
byte[] p = Encoding.UTF8.GetBytes(d);
            byte[] r = Encoding.UTF8.GetBytes(q);
         
            foreach (var item in p)
            {
                if((item)==p.Contains(Convert.ToInt32(item)+1))
                {
                    count1 += 1;
                }

could you please help the error is byte[] doesnot contain 'contains' .
C#

Avatar of undefined
Last Comment
Chris Stanyon
ASKER CERTIFIED SOLUTION
Avatar of Misha
Misha
Flag of Russian Federation image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of ghj Grandhe
ghj Grandhe

ASKER

i converted it into list and i can able to get some clues

  List<byte> p = Encoding.UTF8.GetBytes(d).ToList();
            List<byte> r = Encoding.UTF8.GetBytes(q).ToList();
         
            foreach (var item in p)
            {
                if(Convert.ToBoolean(item)==p.Contains(Convert.ToByte((item)+1)))
                {
//operation
}
}
SOLUTION
Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
C#
C#

C# is an object-oriented programming language created in conjunction with Microsoft’s .NET framework. Compilation is usually done into the Microsoft Intermediate Language (MSIL), which is then JIT-compiled to native code (and cached) during execution in the Common Language Runtime (CLR).

98K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo