|
The #define directive in C# doesn't do the same as in C++. A #define in C++ defines a macro, while in C# it defines a precompiler symbol.
---
single minded; short sighted; long gone;
|
|
|
|
|
didnt have that in mind earlier
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
There is no substitute for the C++ #define in C#. Thankfully there is no precompiler macros in C#.
Your code can be written using a constant in C# (as already has been suggested). It's not the same as a C++ #define, as it's not a macro, but in your special case the result is exactly the same. The value of the constant will be replaced at compile time.
---
single minded; short sighted; long gone;
|
|
|
|
|
Use a constant. Or consider using an enum of the months;
enum Month { January=1 ... } ;
Month monty = (Month) System.DateTime.Today.Month ;
System.Console.WriteLine ( Monty.ToString() ) ;
But if you really want to, you can use the C preprocessor with a C# source file or any text file you happen to want to mess with.
|
|
|
|
|
Is there any way when on calling the method UndoCheckout of IVSSItem interface, it should not replace the file copy at hard disk with the master copy of source safe.
I hope i have conveyed my question.
Best Regards,
Mushq
Mushtaque Ahmed Nizamani
Software Engineer
Ultimus Pakistan
|
|
|
|
|
Hi.,
I want to get a record from MS Access where a datetime field is equal to a C# DateTime type's ToShortDateString(), for example,
DateTime myTime = DateTime.Now;
string query = "SELECT * FROM myTable WHERE [date] = '" + myTime.ToShortDateString() + "'";
Now, is it correct syntax or do I need any Convert function in JET SQL ?
Is it correct to compare with C# DateTime's ToShortDateString() formatted value with JET SQL Date type field ?
I want to compare only the Date part, no Time stamp. I want to get all records for the same date I query. But if it compares also with the time part, then In fact I will not get any record in return because it is not useful to get a records for a particular second.
Would you please help me.
Thanks.
|
|
|
|
|
Try this:
"SELECT * FROM myTable WHERE DateValue(date) = '" + myTime.ToShortDateString() + "'";
Parwej Ahamad
g.parwez@gmail.com
|
|
|
|
|
Dear Parwej
Thanks a lot for your help. Now it is working.
|
|
|
|
|
Hi all,
I am a new user in c# infragistic.
In c# windows application, i use ultrawintree in outlook express view style.
Now i'm trying to add new root in running time, but it don't change anything.
But if i change the view style in default style, it will add new root.
Can any one help me?
Or can any one give me the tutorial?
Many-many thanks..
|
|
|
|
|
Hi,
Many of the folks in this forum don't work with the Infragistics controls. If you don't get an answer to your question here, I suggest you post in the Infragistics forums, or look over their examples and documentation.
|
|
|
|
|
Judah Himango wrote: Many of the folks in this forum don't work with the Infragistics controls
...and with good reasons, too! They might look great, but they are horrible to program against.
|
|
|
|
|
Is that right? Interesting. I've never worked with them before.
|
|
|
|
|
Hi
the title said it.
I want to read a barcode from a USB barcode reader
into a TextBox.
how can I do that by Code?
|
|
|
|
|
I expect a hardware device to come with a driver and a manual?
if not, Google the make and model.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Most bar code readers come with a driver which can be set to emit text into the control that has the focus.
If there's no driver, you can't do anything with it.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
The barcode readers take the input just the same way as you give the input from a keyboard or a mouse. So if u have the drivers installed properly, I think it should be much trouble for u
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
When barcode readers read a codebar send an input as keyboard. Generally send the barcode and a final return. But it may very or be configured.
Metrologic codebar readers work in this manner
Visit my blog at http://dotnetforeveryone.blogspot.com/
|
|
|
|
|
I am writing the contents of a huge DataTable (60000 rows, 15 columns) into a text file.
Method 1: I am appending the entire content of the DataTable to a StringBuilder and then writing it to a text file in one go.
RUM TIME: 25 mins
Method 2: I am writing one row at a time to the file. ( I am still using a StringBuilder, but I am clearing the String builder after every row)
RUN TIME: 30 secs
Why this huge difference?
I have a theory, but i wouldn't want to influence your thoughts.
|
|
|
|
|
rsunilbabu wrote: Why this huge difference?
I don't know, but if I wanted to know (note: "know" does not mean "guess"), I would use a profiler to discover why.
|
|
|
|
|
IO is always faster when writing big packages instead of many small ones. I assume you use a StreamWriter to write the file. Try increasing its buffer to one megabyte (default should be one kilobyte) and method 2 should become faster.
|
|
|
|
|
Method 2 is faster....the second method took "30 seconds" only....
|
|
|
|
|
I should read more carefully. I read sec on both methods...
Theory A: You are using some kind of threading in method 1. As far as I remember StringBuilder is allergic against that.
Theory B: Physical memory gets low and thus it is swapped to hdd.
Theory C (my favourite): Every now and then the StringBuilder allocates more space. Everytime it does this it must copy the content it had before to the new memory space (like an Arraylist). This could be easily tested by giving the StringBuilder an appropriate capacity into the constructor.
Theory D: I don't have a f***ing clue
Robert
|
|
|
|
|
My theory is close to your "Theory C".
The process was slowing down as I add more and more rows. May be larger swaps?
But hard to figure out a 24 minute difference
I am still wondering about Theory A. I am doing this in a timer_elapsed event in a windows service. That may be a thread in the background!?! It may be adding to the time as well.
How the hell I am going to explain to people that the program which is was running for 25 mins now only needs 25 secs. I don't have to......but its embarrassing.
|
|
|
|
|
rsunilbabu wrote: How the hell I am going to explain to people that the program which is was running for 25 mins now only needs 25 secs.
Just tell them you are a genius but didn't want to show off with this right from the beginning...
Robert
|
|
|
|
|
Set the StringBuilders Capacity to the estimated filesize when u construct it. Or better, use the StringWriter.
|
|
|
|