sounds a bit like homework, but:
bool IsBitSet(byte b, int pos)
{
return (b & (1 << pos)) != 0;
}
pos 0 is least significant bit, pos 7 is most.
More Related Contents:
- how to convert 0x8080 to 8080 int? [closed]
- Most common C# bitwise operations on enums
- Is shifting bits faster than multiplying and dividing in Java? .NET? [closed]
- C# int to byte[]
- Difference between ObservableCollection and BindingList
- XML serialization of interface property
- String Concatenation using ‘+’ operator
- Kill process tree programmatically in C#
- Is there a good way to convert between BitmapSource and Bitmap?
- How to save a List on Settings.Default?
- How do I determine a mapped drive’s actual path?
- Get File Icon used by Shell
- Escape invalid XML characters in C#
- How do I split a string by strings and include the delimiters using .NET?
- Model-View-Presenter in WinForms
- how to use XPath with XDocument?
- DataGrid column width doesn’t auto-update
- Travel through pixels in BMP
- JSON Serializer object with internal properties
- memcpy function in c# [duplicate]
- .NET Core vs Mono
- Can I Override with derived types?
- Application_Error in global.asax not catching errors in WebAPI
- Validating file types by regular expression
- ASP.NET Web API and [Serializable] class
- trying to convert rgb from a .net Color to a string such as “red” or “blue”
- Reading a date using DataReader
- What’s the best way to represent System.Decimal in Protocol Buffers?
- Out of memory exception while updating zip
- LINQ Query to Convert string to datetime