Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

C#: How to assign const chars by their hex values?

Posted on 2009-05-20
4
Medium Priority
?
1,030 Views
Last Modified: 2013-12-17
Hi all,

I know in C you can assign const chars like so:

const char cSpaceSymbol = 0x20;

What is the C# equivalent? I want to assign const chars based solely upon the hex value. Thanks in advance!
0
Comment
Question by:ehensens
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 

Author Comment

by:ehensens
ID: 24435492
Or the decimal value, obviously.
0
 
LVL 40

Accepted Solution

by:
mrjoltcola earned 2000 total points
ID: 24435503
Try:

char ch = (char)0x20;
0
 

Author Comment

by:ehensens
ID: 24435515
Didn't think it'd be that easy & quick, thanks!
0
 
LVL 40

Expert Comment

by:mrjoltcola
ID: 24435546
Welcome!
0

Featured Post

Use Filtering Commands to Process Files in Linux

Learn how to manipulate data with the help of various filtering commands such as `cat`, `fmt`, `pr`, and others in Linux.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question