1. In the pattern "Too Many Pointers", what means "they merely "slide" together to remove the wasted space"?
2. In the pattern "Too Many Object Writes", I do not quite understand the emunerator and collector pattern, could anyone provide some brief pseudo code please?
If you are, for instance, doing simple operations in some kind of enumerator class, you might find that you need to move some of your key pointers from the main collection into the enumerator at every step. This is actually something you might want to avoid, because you effectively double the cost of copying those pointers around due to the write barrier and you might have to do it one or more times per loop on the enumerator.
could anyone provide some brief pseudo code please?
The "for instance" is just talking about copying a reference from the collection into an enumerator of the collection as a method of implementing an enumerator. Anytime you copy a reference the GC system has to track it so it comes at an expense. There isn't much you can do in a GC environment that doesn't come at an expense.
These two reasons are of course complemented by the usual reasons for not doing too many writes in any kind of program. All things being equal, it's better to touch less of your memory (read or write, in fact)
George, why to you keep asking us question for which there is already a perfectly acceptable and easily found[^] answer?
What means .... "driving factor"?
That means every project has it's own factors related to optimization needs. They can be very different from project to project. For example the use model of a system typically provides an understanding of many of these factors.
Sorry it is my bad English. Now it is clear now. Sorry I have another question about the 1st link,
"On questions such as these, there are two ways to find the answer. The first is to build the code and look at the generated IL (or the resulting assembly, remembering that you get debug code if you run in the debugger. Attach to a running process, and then you get the optimized native code), or to time the code with a stopwatch."
I think either in debug mode in Visual Studio or attach to a running process, we can only debug through either the source code or the native code, any ways to debug through IL code in debug/release mode?
(the location of the tags and finally the values are important, because otherwise it won't appear to be a table
the _01 is used to help me replace the tags with it's values.
so lets say i do want to duplicate this line ten times to finally have 11 lines.
the replacement of the _01 to _02 etc. isn't the challange for me, but i wonder how to insert the new lines at the correct location. because as far as i know i am only able to insert it at an index position. well, in my case i would try to find the _01 entries by reading line after line in the file. when i find it i copy these two lines to a tempstringvariable. then loop for the desired number, replace _01 by _02 etc.
now the tricky part: i have to find out at which position the two lines end. well i guess this is indexof(tempstring) + tempstring.length + 2 (linefeed). and then insert the lines + linefeeds into there.
but isn't there an easier way like "insert line after this line"?
thanks for any further hint which help me realize this in a more easy way!
I think you may have a knowledge representation issue here. You're representing the template with a single string, right? In that case, you've built a find-replace model where now you need an example-build model. Looks like you're going to either A) devise a very clever solution using your current system by changing the table template to a line template B) change your templating model to have better supporting code or C) get rid of the template system in favor of a custom formatter or custom StreamWriter.
"Run for your life from any man who tells you that money is evil. That sentence is the leper's bell of an approaching looter." --Ayn Rand
when i enter a text in any WindowsForms Textbox with forward slash "/" the textbox reverse the text and make it wrong
e.g. if i enter 990 first then / then 130 the system will display it 130/990 note 990/130...
how can i solve that?
Tip: Use the pre tag when posting blocks of code. It makes it readable.
As far as I can see you only have overloads of the Insert method that takes an IComparable parameter. The Patient class doesn't implement the IComparable interface. Even if it would, the variable p1 is an IPatient reference, so it can never be used as an IComparable reference even if the actual ojbect would implement the IComparable interface.
Make the Patint class implement the IComparable interface, and change the variable p1 from an IPatient reference to a Patient reference.
Despite everything, the person most likely to be fooling you next is yourself.
//here is the IPatient implementation
public class Patient: IPatient, IComparable
private string fname;
public string FirstName
fname = value;
public int CompareTo(Patient obj)
//Patient p1 = (Patient)obj;
//the main method
static void Main(string args)
Patient p1 = new Patient();
BSTree container = new BSTree();
Console.WriteLine("Enter the first Name of the patient:");
p1.FirstName = Console.ReadLine();