|
Try this: [ColinMackay]
I just now figured out how to do it lol
|
|
|
|
|
Hello :
Thanks a lot about this link , I'm really praise it
Thanks
|
|
|
|
|
I
l
i
k
e
y
o
u
r
t
a
l
l
s
i
g
.
C
a
n
'
t
y
o
u
m
a
k
e
i
t
a
b
i
t
t
a
l
l
e
r
?
|
|
|
|
|
Make it taller?
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
According to MSDN, methods of IEnumerator are expected to throw an exception if the enumerated collection has been modified
For Example,
<br />
List<int> list = new List<int>();<br />
list.Add(1);<br />
<br />
IEnumerator enumerator = list.GetEnumerator();<br />
<br />
enumerator.Reset();
<br />
list.Add(2);
<br />
enumerator.Reset();
When implementing the methods of IEnumerator in our own class, we should have them throw the exception if the collection is modified.
Now I have a class :
<br />
class MyEnumerator:IEnumerator{<br />
int[] integers;<br />
<br />
<br />
public void Reset(){ }<br />
}
How to implement Reset in an elegant way, so that I can throw an InvalidOperationException when Reset is called after integers are modified?
Thank you!
|
|
|
|
|
Hi,
I have not done this yet, but here is an idea:
- in the object you want to be able to enumerate, keep a generation counter that starts at
zero and gets incremented every time you modify the collection (hence Add, Remove, Clear,
... all contain "generation++;")
- in the enumerator hold a copy of the generation counter, equal to the collection's
generation at the moment you create the enumerator
- in each enumerator method compare enumerator generation with collection generation;
when unequal, throw the exception.
Refinement: to reduce the risk of generation overflow, rather than incrementing all the time,
your collection could keep two generation values (current and next), that both start at zero.
Each modification sets "generation=nextGeneration;", and each getEnumerator
does "generation=nextGeneration++;" hence the generation can only increase if an enumerator
has been requested.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Yeah, I see, thanks for your neat idea.
Then my collection class has to expose an extra property, say Generation{get{}}, right?
|
|
|
|
|
SeeBees wrote: expose an extra property, say Generation{get{}},
Not really, if your Collection inherits from an existing one, you can implement
your own public override IEnumerator GetEnumerator() just like the
original collection did.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
can any body have any idea regarign calendar delegation in OWA. any link or any idea !!!
Thanks in advance
|
|
|
|
|
Hi
I want to create a custom toolbar having a drop down menu and two controls (a textbox and a button) for Internet Explorer using c#. i have never done this type of work before. it is a core functionality of my project. can anyone tell me about this.
Ahmed
|
|
|
|
|
This[^] article should get you started.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Every time I maximize an MDI child window, it resizes the icon in the parents menubar and deforms everything, is there a way to prevent the icon showing at all.
P.S. I set the Child ShowIcon command to flase, but it still brings up a small icon in the menubar, I don't want that either.
modified on Saturday, February 02, 2008 8:52:34 AM
|
|
|
|
|
Hi,
I have a printer that is connected to computer with usb port.
How can I print a file (document or image) using the printer?
i.e with clicking a button printing of the file began.
Best wishes
|
|
|
|
|
Hi,
.NET contains a number of classes that deal with printing (PrintDialog, PrintDocument, ...).
It does not matter how your printer is connected to your PC, as long as it has a valid driver
it should pop up in the list of available printers (as in the Printer combobox in Word's
print dialog).
Look for examples in the CodeProject articles; my Sokoban article knows how to print
a simple graphic.
Note: I do not claim it is simple, taking care of print previewing, page orientation,
duplexing and collating is rather hard. It is after all a complex matter.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
hi
how to attach file to mail using C# code ?
thank's
|
|
|
|
|
|
hi all.
i have written a Bwroser Help Object using visual c# 2005.
Now how i install and deploy it on my client machine.
many of my client machine has not dot net framework.
should dotnetframwork be installed to run this small dll?
sepel
|
|
|
|
|
Hello everyone,
Lately, I'm concerned about internet protocols and had this big question of how such proxy avoidance websites work?? Can I create my own?? How??
Any good articles/hints would be appreciated as I have no idea where to start from..
Thank you guys
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
how to return arrays from functions?
if the array is created inthe function itself.
|
|
|
|
|
By defining the return type as array and return it, no difference from other data type.
public string[] GetStrings()
{
string[] arrayOfString;
// define array, do stuffs
return arrayOfString;
}
|
|
|
|
|
Strictly speaking, you don't return the array itself, but the reference to it, as with any object.
public int[] GimmeSomeInts() {
int[] result;
result = new int[] { 1,2,3,92849832 };
return result;
}
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
How do i add a list of items for an embedded windows media player to play.
threw website/you're own movies. Or what is the code to link a button to set the media player to read the next video, or add a new url to the player?
If anyone can show me an article on how i can do this. Be most appreciated.
Also i've made my program so it's a fixed tool window, how can i make a button in my menu to be able to move it. It won't let me click/drag as a fixed tool window, and i don't want it to be a fixed 3d border.
Thanks in advance.
|
|
|
|
|
hi all ,
i want to create an app to change or remove password of my user in pc .
when my pc load , for some user that we created password , we have to enter the password (sometimes we forgot this password ) , in any case with using c# how can i do it ?
thanx a lot for any guide .
s_mostafa_h
|
|
|
|
|
hi
My aim is to ping a socket....i want this to be done from one side i mean the application which is sending the ping signal(byte)....should not take response from the client.......
i tried with socket.send ...it doesnt ensures that bytes are received at client side or not
then i tried with socket.sendto....same thing
so if any one knows how to do this please let me know............
regards
sindhu tiwari
its me sid
|
|
|
|
|