|
This is from the C# Language Specification[^]
The following pre-processing directives are available:
• #define and #undef, which are used to define and undefine, respectively, conditional compilation symbols (§2.5.3).
• #if, #elif, #else, and #endif, which are used to conditionally skip sections of source code (§2.5.4).
• #line, which is used to control line numbers emitted for errors and warnings (§2.5.7).
• #error and #warning, which are used to issue errors and warnings, respectively (§2.5.5).
• #region and #endregion, which are used to explicitly mark sections of source code (§2.5.6).
• #pragma, which is used to specify optional contextual information to the compiler (§2.5.8).
Enjoy,
Robert C. Cartaino
|
|
|
|
|
Did you mean this to go to me or the original poster? Good reference on what directives are available, but the question was really about what compilation symbols are defined by default. The OP wanted to know how to write the equivalent of #if WIN in C# (assuming that "WIN" is a predefined conditional symbol in C++), to which the answer is still "there isn't".
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines][ Articles][ Blog]
|
|
|
|
|
Scott Dorman wrote: Did you mean this to go to me or the original poster?
No, not really to the original poster nor directly to you either. I just thought it a good place to inject further information into the thread. I was just following up on the part of your answer that said, "...It does have support for the #if preprocessor directive." I was just adding to the conversation.
|
|
|
|
|
Robert.C.Cartaino wrote: No, not really to the original poster nor directly to you either. I just thought it a good place to inject further information into the thread. I was just following up on the part of your answer that said, "...It does have support for the #if preprocessor directive." I was just adding to the conversation.
No worries, just wasn't sure if this was a "general" post or not. The list of available directives is good, as many people probably don't know about them.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines][ Articles][ Blog]
|
|
|
|
|
Can i get some guidance?
I would like to display jpeg data on a picture control or control of some sort that is on a form. What exactly would i do here to accomplish this?
|
|
|
|
|
click the little [...] button next to the "Image" field under the "Appearance" section of the picturebox's property window.
-Spacix
All your skynet questions[ ^] belong to solved
I dislike the black-and-white voting system on questions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Fu/LAAd1W0AwDBoAAL39QBIzpEAmEHnAAAZLQD++QAAjrPxsw
IAQQC+/wP0/uzd7vgXbTz/8wkGEv0ABQ8NAAH25AAUEgwAwfETAO0EFAAV5M8Aae6oA
JpK8AAVUC8AAO/9AIKH1QCzyPVVAgickLgFzPLrf1ye4K7
1g4HXQpBBUI4d6OT/DGxfuBn+/vrP8A8YkEzsTAzMOn8Z
2OUUGM5u/MjgsoTryJe3Jx0BAghsACMjI7egkMXe4o+Xz
F15vjFwqjAx8KhyM/CKczMwsjEA0x0bAyPrfwYOuX8Mu8
5wMyRt4X/4+sVpc6DelwABBDOAEZglRNjEHWcbfH3mH/btIYPmvx8MQEsZ2MUYGdhVWBhesPMyzH8qwrD9g8TFHy
8OhQLVPwDq/Q0QQGADQABoBlA5gyATl5QpC596LdAT+lz
AghuAAwADeIAuQaIRYGYl4lLgu/ftxevgew3QPwKiL8C9
fyDqQcIMACDoJbT47bbfAAAAABJRU5ErkJggg
So I used this method :
private Image Base64StringToImage(string base64ImageString)
{
byte[] b;
b = Convert.FromBase64String(base64ImageString);
MemoryStream ms = new System.IO.MemoryStream(b);
Image img = System.Drawing.Image.FromStream(ms);
return img;
}
but this Exception occurred :
Invalid length for a Base-64 char array
What do I have to do ?
Sorry for my English. I'm a freshman .
|
|
|
|
|
Google for the exception text.
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
it is invalid data for base64
-Spacix
All your skynet questions[ ^] belong to solved
I dislike the black-and-white voting system on questions/answers.
|
|
|
|
|
Thanks.
Sorry for my English. I'm a freshman .
|
|
|
|
|
Hi
I tried to apply custom drawing on Windows Vista titlebar, interecepting WM_NCPAINT message.
To get a device context I used GetDCEx API function, but it fails if a second parameter is
a pointer to a clipping region ( wParam ), so I had to pass it IntPtr.Zero. It works, but then
all drawing logic is performed inside the window client area.
Is there any other solution to modify non client area on Windows Vista?
Thanks.
|
|
|
|
|
|
|
Start by asking in the correct forum. You are looking for ASP.NET..
|
|
|
|
|
(Just learning C# and trying to do what I did in C++ with C#, and this is not an urgent question)
I have a COM "server" with a method FileOpen which returns a HRESULT :
...
[id(2), helpstring("Open a file.")] HRESULT FileOpen([in] BSTR filename);
...
STDMETHOD(FileOpen)(BSTR filename);
...
When I added the reference to my COM stuff in my sample C# project, the method is listed as Void FileOpen(...) (when I look at the browser in the IDE), I loose the return code.
Am I missing something ? As far as I understand, the COM is wrapped in a proxy (Runtime callable Wrapper) of some kind; I assume this strips the return value from the prototype ?
Thanks for any help, hints, tips, or links (or even better) for google keywords that can help me in my searches.
Max.
This signature was proudly tested on animals.
|
|
|
|
|
Maximilien wrote: this is not an urgent question
That makes this a very very good question
Maximilien wrote: the method is listed as Void FileOpen(...) (when I look at the browser in the IDE), I loose the return code.
That is correct. AFAIK, the COM wrapper will check the HRESULT and auto throw the COM Exception, kinda neat, hey? (I could be completely wrong too, hehe)
|
|
|
|
|
That's what I just discovered, and above all, there is a HResult property in the System.Exception
Thanks.
This signature was proudly tested on animals.
|
|
|
|
|
|
baai koel
|
|
|
|
|
ja lekker hehe
|
|
|
|
|
Well I didnt really know, well maybe I did, I have been grinding on .NET for almost 7 years so I cant really recall. Anyways just follow the element of least surprise principle
|
|
|
|
|
I am using StreamWriter to write out some jpeg data in byte[] to a file.
The result of my file is always "System.Byte[]"
byte[] jpegData = new byte[img.Length];
jpegData = Convert.FromBase64String(img);
using (StreamWriter sr1 = new StreamWriter("C:\\123.jpg"))
{
sr1.Write(Convert.ToString(jpegData));
sr1.Flush();
sr1.Close();
}
|
|
|
|
|
Why don't you use BinaryWriter instead?
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
System.IO.File.WriteAllBytes()
|
|
|
|
|
Thanks, this worked great.
Do you know how i would write this jpeg data in the form of byte[] to a form instead of to a file? So in other words i would like to display jpg on the form. Would i need a picture control?
|
|
|
|