|
The object that you have created doesn't contain what you think it does. The expression is first evaluated, then the result (a boolean) is boxed into an object. The reason that you can convert it to a boolean is that it already is a boolean.
Evaluating an expression is a bit more complicated than that. Look at this example: Compiling C# Code at Runtime[^]
---
b { font-weight: normal; }
|
|
|
|
|
besides 'trial and error' are there any good debugging tutorials? thanks
|
|
|
|
|
...---... wrote: besides 'trial and error' are there any good debugging tutorials?
Isn't that what debugging mostly is? You write code, you try it out, an error is generated, you examine the value of the variables, the objects, take note of the exeption that was thrown and try again setting a breakpoint somewhere before the error to see the flow of the application to determine why it went wrong.
Then once you understand that you write a unit test to ensure that code path has a test, if it didn't already, so that if the error rears its ugly head once more then you see it instantly in the unit tests.
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
|
|
Have a look at the MSDN Nuggets videos on debugging. There's one called "Tools for Debugging" or something like that. There's a whole section just on VS 2005 debugging. But some of it is applicable to VS 2002/3 debugging too. You will get some ideas from watching a few of them.
http://www.microsoft.com/uk/msdn/events/nuggets.aspx[^]
Kevin
|
|
|
|
|
Hi all
I'd like to write a Winform application (C#) which shut down the computer after certain minutes but i don't know how to call and which WIN32 API to do this.I've read an article on this site about that but it's not clear.Please help me.Tnx
|
|
|
|
|
|
Hi,
I would like to know how to use code to change text's font and style within a text box or an enrichtextbox. Thank alot
|
|
|
|
|
|
is it possible to change partially of the document's style and fonts within the enrichtextbox?
|
|
|
|
|
Is there anyway to embedd a J2ME/J2SE application into C#? For example, i have the code for a small java game, i want it to be able to be ran in c#, is there anyway? maybe thru j# or something?
|
|
|
|
|
Sure, compile the Java code as J#. From there, you can call the methods in your J# application from C# as if it were written in C#.
Also, an alternate route is compiling your code using Mono's IKVM[^].
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Bought a House!
Judah Himango
|
|
|
|
|
Is there a way to specify a timeout to StreamReader.ReadToEnd() ?
Thanks,
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
No, there isn't.
Why would yo want a timeout for something that returns the contents of the Stream immediately? What are you trying to do?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave Kreskowiak wrote: Why would yo want a timeout for something that returns the contents of the Stream immediately?
If only it (always) did. I was hoping to not have to spin off a worker thread to do the read.
<code>
HttpWebRequest req =
(HttpWebRequest) WebRequest.Create ("http://ravib.com");
HttpWebResponse resp = (HttpWebResponse) req.GetResponse();
Stream stream = resp.GetResponseStream();
StreamReader streamReader = new StreamReader (stream);
string strContent =
streamReader.ReadToEnd(); <code>
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Wow!! The new information makes all the difference in the world! Now we know you're actually using this to download a web page.
Try using the WebRequest[^] version instead. This one supplies asynchronous methods to BeginGetRequestStream and, more importantly, End it!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave Kreskowiak wrote: This one supplies asynchronous methods to BeginGetRequestStream
While that form allows the caller to asynchronously get the stream, that's not the problem. The problem is waiting for a read from the obtained stream to complete.
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Setup your own timer that waits for however many second before you call EndGetResponseStream. You'll get whatever was returned until the timer expired.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
How Do I Execute shell command in c# ?
{like i you do in DOS}
|
|
|
|
|
|
I've got (what I think is a simple) problem.
To which (I fear is not so simple) to fix.
Currently I am trying to configure a setup project for my current solution (written using VS 2005 TS) now my solution consists of two or more projects (not including the setup project of course) I say two or more projects because my solution houses at the moment 2 VSTO designed word documents that are coded to pull information from a database fill in the blanks and print out the resulting document and close word automatically, I still have several Excel spreadsheets to code so the project list will grow.
Now to access each of the word "documents" the Main project has a Process object that has it's properties set to point to the required word document. the program simply runs the process and each document handles closing itself and word automaticaly. right now the two documents full path locations including the document file name are stored in two string constants in the main programs .config file.
under VS each of the two string constants are pointing to the ..\bin\release\"Document".doc under each word document's project folder
Now my setup project at the moment has all the outputs from each project installed into the same folder under Program Files (which is just fine by me it's not that complicated to warrant sub folders)
Now the problem lies in the fact that now the required document are no longer located where the .config file constants say they should be (they will be in the installion folder). Now I understand that any .config file under .net is XML and as such reading and writing to it should be as simple as reading and righting to a DB table my problem is how do I get my setup project to change the .config file's constants to point to the installed documents new locations.
Ryan
Data error reading Common Sense
Abort,Retry,Ignore,Fail?iiiiiiii
|
|
|
|
|
My frd just write a custom action that will do the job for you and then add it in the setup project using Custom Actions view.
To create a custom action, add a new project of type "Class Library", then add an installer class and override its "Install" and "Uninstall" methods. Both methods contains an argument of type IDictionary which can be used to store information that you want to pass to uninstaller from the installer. Call your config update logic from the install method.
Finally add this project in setup as custom action from custom action view.
Akif
|
|
|
|
|
Thanks so much for the help it was exactly what i needed much appreciated
Ryan
|
|
|
|