Solved

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

Posted on 2009-05-20
4
1,015 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
  • 2
  • 2
4 Comments
 

Author Comment

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

Accepted Solution

by:
mrjoltcola earned 500 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now