|
Use a GUID for a filename - they're guaranteed to be unique, and therefore aren't susceptible to stopping/restarting the program.
for (int indx = 0; indx < contact.Fields.Count; indx++)
{
string guid = Guid.NewGuid().ToString().Replace("-","").Replace("{","").Replace("}","");
StreamWriter sw = new StreamWriter(string.Format("D:\\Temp\\{0}.xml", guid));
sw.WriteLine(contact.Xml);
sw.Flush();
sw.Close();
}
If you don't want to delete the hyphens or curly braces, remove the Replace() method calls.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hello,
Is there a (relatively simple) way to know whether the compiler has inlined my method? (Actually I want to make sure that it did...)
|
|
|
|
|
No, and you will have no guarantee that a function will be inlined. Actually, it's not job of the C# compiler, but rather the JIT that does the inlining at runtime, if it decides to do so. But you have no control over it and can not rely on a function being inlined.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Greeeg wrote: But you have no control over it and can not rely on a function being inlined.
Well, there is one sure fire way, but that involves getting hired by Microsoft in a position on the CLR team and writing code to do this.
|
|
|
|
|
Pete O'Hanlon wrote:
Well, there is one sure fire way, but that involves getting hired by Microsoft in a position on the CLR team and writing code to do this.
The first thing I'd do with this new job would be to introduce some kind of forceinline directive
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Greeeg wrote: introduce some kind of forceinline directive
That would be nice.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Well, thanks a lot. But since, I'm very concerned about performance, I'd appreciate more of your expertise. There are some methods that I'm writing just for modularity reasons. Each is just a single line of code. For example:
class X {
public int Value { get { return getExternalValue(); } }
private int getExternalValue() {
}
} I am thinking that the JIT should be intelligent enough to actually inline both methods. But is this assumption true? Or should I inline the method myself?
Many thanks to all helpful guys here in CP!
I really appreciate your help.
Know me better
|
|
|
|
|
hosamaly wrote: I am thinking that the JIT should be intelligent enough to actually inline both methods. But is this assumption true?
Nobody (apart from the Microsoft CLR team) knows exactly under which circumstances the JIT optimizes code. While the JIT probably is intelligent enough to see that the function can be inlined, it still might decide not to do so based on other parameters.
So in your case, if you're really concerned about performance you probably should inline it yourself - it'll always be a compromise between modularity/readability and performance.
This article[^] and this blog entry[^] talk a bit about the JIT method inlining, you may want to take a look at them.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
You are micro-optimising. In any normal situation it will not make any real difference if the method is inlined or not.
If you really need that litte extra performance, you should probably not only inline this method, but the method that you are calling also...
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
You're right. I'm just trying to write micro-optimized code that is maintainable to some level. I'm introducing a wrapper layer for some external functions, but performance is at premium, so I'm trying to optimize it as much as possible, without exposing the external interfaces to other layers.
Many thanks to all helpful guys here in CP!
I really appreciate your help.
Know me better
|
|
|
|
|
If you really need to optimise the code so much that you need the methods to be inlined, you are way beyond maintainable code. If you are still thinking of maintainable code, you should not bother with the tiny performance difference that inlining methods means.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hello everyone,
I am reading WSDL and SOAP spec and my purpose is to learn Spec/protocol details, for example, the component model of WSDL/SOAP and meaning/relationship between sections of messages/XML.
Now I am learning from Spec, but find it so boring to learn and not very readable.
http://www.w3.org/TR/wsdl20/
http://www.w3.org/TR/2007/REC-soap12-part0-20070427/
My question is whether there is more readable documents or turorials? Or learning web sites?
thanks in advance,
George
|
|
|
|
|
Has any one has done this , who is online of the user who has given his valid credentials.
“You will never be a leader unless you first learn to follow and be led.”
–Tiorio
"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford
|
|
|
|
|
Mogaambo wrote: Has any one has done this
i dont think you can, not unless you work for Google and have access to their systems...
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.Passion != Programming & you.Occupation == jobTitles.Programmer)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
Then how meebo done, and also koolim done that task
“You will never be a leader unless you first learn to follow and be led.”
–Tiorio
"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford
|
|
|
|
|
who are they?
why not try and search Google API[^]
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.Passion != Programming & you.Occupation == jobTitles.Programmer)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
check this sites
x17.iloveim.com
www.meebo.com
www.koolim.com
“You will never be a leader unless you first learn to follow and be led.”
–Tiorio
"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford
|
|
|
|
|
well if it is possible, then google must make the information available via an API
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.Passion != Programming & you.Occupation == jobTitles.Programmer)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
Mogaambo wrote: Then how meebo done, and also koolim done that task
Because they are IM clients. Here's[^] how it's done.
|
|
|
|
|
but i want of google, so if u have similar link then it will very helpful to me
“You will never be a leader unless you first learn to follow and be led.”
–Tiorio
"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford
|
|
|
|
|
|
i don't think that was the correct way to implement because it does not asks for password.
“You will never be a leader unless you first learn to follow and be led.”
–Tiorio
"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford
|
|
|
|
|
How can i create the registries ? i made a image Editor software. now i want that only authorize person can only access to it via registry..
i dont know about it...
plz explain me in simple form or words which can i understand....
and with some code
hghghgh
|
|
|
|
|
Hello,
I noticed today that the System.Runtime.InteropServices.Marshal class has overloads of the Copy method in the form: Copy(IntPtr source, int[] destination, int startIndex, int length); , but there are no overloads for unsigned data (e.g. uint ). I wonder why?
Thanks in advance.
|
|
|
|
|
Perhaps because uint type is not CLS[^]-compliant.
|
|
|
|