|
OK, I meant the .NET framework...
C# is compiled to msil, wich is the .net framework language...
Another way of writing it is:
The out func of C# and a lot other funcs it got is really slow
Wich meant what I meant...
The one and only Niklas Ulvinge aka IDK
|
|
|
|
|
What I'm getting at is that C# isn't slow. The particular method you are using is slow because it takes into account a whole host of things like culture, formatting options and so on. If you only ever want to output something in a very simple way then Console.WriteLine is too feature rich, and that is what you are paying for. There is nothing stopping you from providing your own implementation if you need speed.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
Thats true.
I didn't think of that...
But how do I access the memmory at 0xA000 ?
The one and only Niklas Ulvinge aka IDK
|
|
|
|
|
Looking at how the Console class works, eventually there is some PInvoking of some native methods to get a handle on the stanard out (stdout) stream.
public static Stream OpenStandardOutput(int bufferSize)
{
return Console.GetStandardFile(-11, FileAccess.Write, bufferSize);
}
private static Stream GetStandardFile(int stdHandleName, FileAccess access, int bufferSize)
{
IntPtr ptr1 = Win32Native.GetStdHandle(stdHandleName);
if (ptr1 == Win32Native.INVALID_HANDLE_VALUE)
{
return Stream.Null;
}
if (ptr1 == IntPtr.Zero)
{
return Stream.Null;
}
if ((stdHandleName != -10) && (Console.ConsoleHandleIsValidNative(ptr1) == 0))
{
return Stream.Null;
}
return new __ConsoleStream(ptr1, access);
}
[DllImport("kernel32.dll", SetLastError=true)]
internal static extern IntPtr GetStdHandle(int nStdHandle);
You could just get the stream and operate on it directly.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
But that's still slower than basic...
The one and only Niklas Ulvinge aka IDK
|
|
|
|
|
|
What do you mean?
The one and only Niklas Ulvinge aka IDK
|
|
|
|
|
Could you please test the same without PRINT and Console.WriteLine?
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Gee whiz, considering that 2GL and early 3GL compilers and linkers had very few commands to operate on compared to today's super compilers it's realy no surprise. However just because C# might not be the fastest language ever invented, development time is cut down, and oh btw, good luck on trying to write a GUI, TCP/IP stream processor, and SQL interface using Assembler. Yeah you could do it but for what purpose?
I used to be an assembler programmer (back in the 80s!) and I'll admit to being concerned about shaving cycles and optimizing every instruction. But those are memories I'll gladly leave behind.
Mike
|
|
|
|
|
Hi all,
I wanna write a program that can monitor and discover any change of file in windows sytem and notify the change to user. where should i begin and what should i read ?
Thanks,
ken
|
|
|
|
|
You can simply use FileSystemWatcher class. It's easy to use. for more information see msdn on this topic.
|
|
|
|
|
Here is some input parameter and a return value of a oracle storage procedure.
How to run with Oledb and get the return value?
Thanks!
|
|
|
|
|
how to save a file using a savefiledialog in C#.what is the complete code for it? how do we use the savefiledialog .
-- modified at 3:43 Saturday 19th November, 2005
|
|
|
|
|
|
v.k.s wrote: how to save a file using a savefiledialog
As stephan already said, the MSDN documentation shows you how.
However, the SaveFileDialog will not save your file for you. It will only generate a standard interface by which your user can choose a location for their file. Once you have that file path you have to save the file yourself. And, no, I cannot give you code for that as I know nothing about the file that you want to save or how you want to save it. If you need to do that, you will have to ask a more specific question with more detail.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
Hi
As our friends said , the savefiledialoge cannot save but can go and read a path to save.
first of all make a filter for your savefiledial. to have an extension for your file name
then with savefiledialoge.show(); you will have the dialoge
after that you can specify a lable for your file path.
make a lable and do this label1.text=savefiledialoge.filename;
after that you can have a file to save
FileStream fs=new FileStream(svdg.FileName,FileMode.Create);
and you can do everything with it
be careful to run fs.close(); after your file.
May MSDN is a bit difficult but it is really useful.
Hope that is work.
|
|
|
|
|
Hello!
I want to add description to my functions that users who uses them can know what's its work, Like .Net framework functions. For an example when we type MessageBox instruction we see some descriptions about that.
Please if you know about this Help Me.
Thank You.
-- modified at 1:42 Saturday 19th November, 2005
|
|
|
|
|
just type /// above the function name and type the comment there . i havent used it , but i heard one of my colleagues mention it a day ago..You can always try
|
|
|
|
|
|
Note, when filling out your documentation, only the information contained in the <summary> and <param> tags get put in the IntelliSense tooltips.
"we must lose precision to make significant
statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
How can I read a string from a database field byte by byte? the DataReader class has two methods that seem useful: ReadBytes and ReadChars . The problem is that the former method can't be applied to a field of type string and the latter one reads the string char by char, not byte by byte. It also seems that the default encoding used by ReadChars method is unicode.
Notice that I don't want to read the bytes from a filled dataset , because after filling the dataset by a DataAdapter , there is a change made to the string that've been read.
Please help!
|
|
|
|
|
I think that what is happening is that the bytes are being altered because they are being stored in different ways to how .NET wants a string. If you really need the bytes then you are going to have to store the bytes in the first place.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
And when i write the string to a file, it doesnt get the newline bit right, you just get a bar.
So how do i get it to do a new line. (I would REALLY like to do this without having to do WriteLine every time i need a new line).
|
|
|
|
|
Shouldn't you use \r\n instead?
-
Drew
|
|
|
|
|