|
Then why have the new copy overwrite the old? Shouldn't it be in a different directory? Or at least have a different version number?
I just remove mine from the GAC during testing -- it works for me.
|
|
|
|
|
OK
Though it would be nice to be able to run both side-by-side...
|
|
|
|
|
Keep it in GAC, because other Apps are using it. Load local A.dll for my App, because I do some change in A.dll, but its version is unchanged, I need the new A.dll for my App.
|
|
|
|
|
Jack20095 wrote: its version is unchanged
That's probably the biggest problem.
What if you build the DLL in its own directory and GAC it from there, then build the new version, copy it to the APP's directory, and reference that version?
|
|
|
|
|
Yes, the trouble is that it doesn't allow to change the version.
|
|
|
|
|
I'm not following you... I'll have to try it.
Edit: I just tried it and saw the same thing. Then I compiled the "test" version of the DLL without the strongname and it worked as required.
So I guess only add the strongname when you're ready to put the DLL into the GAC.
modified on Friday, August 13, 2010 11:33 AM
|
|
|
|
|
I am new to C#, so I am not sure if I am asking this right so be gentle ..
I know how arrays work in general, but am not sure how do this:
Instead of 3 arrays, use one array assigned to a class ?
ie:
I want to create an array say 10 elements.
numbers = new int[10];
Can I use a class vs. the int ?
numbers = new rdata[10];
public class rdata
{
int value1;
int value2;
int value3;
}
Would I use set/set methods to access that data by:
rdata[pointer].value1 rdata[pointer].value2 rdata[pointer].value3
Thanks In Advance
|
|
|
|
|
Hi,
rdata[] numbers = new rdata[10];
would be fine; it is an array capable of holding ten (references to an) rdata objects.
dluurs wrote: Would I use set/set methods to access that data
you could have public variables (data members) in your class, however this isn't considered good practice; you could have public properties (known as getters/setters to some), that would be perfect.
You should pay more attention to the case of identifiers, the formatting of your code, and a lot more. I strongly suggest you buy and study an introductory book on C#, it is the best (and fastest) way to learn the language properly, as it is bound to present you all the necessary knowledge in a structured and consistent way; of course you should experiment while studying. So go to the book store and look at some books, choose one, and enjoy.
|
|
|
|
|
(I suspect he's already taking a class.)
|
|
|
|
|
In addition to Luc's advice you may wish to take a look at .NET Book Zero[^] by Charles Petzold. It's an excellent primer and it's free.
It's time for a new signature.
|
|
|
|
|
Hi, all,
I'm writing about ListBox.SelectedValueChanged. I know it fires twice, once on deselect and once on select, when the selection changes (although I find that behavior strange).
I'm wondering if anyone knows of a way to determine which event is occurring. I have a large event handler that fires off that event, and I don't want it to run twice.
I had thought of using a boolean to toggle back and forth between the two states, but I am terrified that it might get stuck in the wrong state if the event ever fires an odd number of times.
Does the listbox or the event args contain something I'm missing that would allow me to do a real test?
|
|
|
|
|
Hi,
if you allow single selection, have a look at SelectedItem or SelectedIndex; if you allow multiple selection, look at SelectedItems or SelectedIndices (and their Count).
You probably need to execute only a small part of your event handler when no item is selected; and you sure need to execute some part only when something got selected.
You probably cannot just ignore the event when nothing is selected, as unselecting may be a legitimate user action requiring some response.
|
|
|
|
|
I looked into this some more...
Apparently the information I'd read about the event firing twice was false or out of date I did a simplified test, and the event only fires once, with the new selected value(s)/index/indices. All the extra events are actually being triggered in my program (for reasons that make sense depending on context).
The event handler had logic in its header to prevent it from firing in certain scenarios where I knew the program would be making too many calls that would change the index (in particular, refreshing the databinding). I realized the current selection was already being stored in a static var, and just added to the short-circuit logic a test: selectedvalue = staticVar --> quick_exit
Works like a charm; the condition is true after the initial pass sets the static var.
Thanks for your help; looking at the selectedindex vals helped me figure out what was happening.
|
|
|
|
|
You're welcome.
Yes, multiple or spurious events can be a burden and don't get documented; some Controls will even fire a Changed event when assigning the current value again, so one always has to program defensively.
|
|
|
|
|
I'm trying to make a logging class and I place SteamWriter.Close() in the destructor, however it seems that Dispose() has already been called on the StreamWriter by the time the destructor is called. Since I cant' call Close(), the text is never flushed to the file. How can I fix this?
Turning auto-flush on helps but i still think i should be closing the stream properly rather than letting it happen automatically at program exit.
|
|
|
|
|
Move your stream reader close call into your dispose method. Call the dispose method from your destructor like:
private bool mIsDiposed = false;
~MyClass(){
Dispose(false);
}
public void Dispose(){
Dispose(true);
}
public void Dispose(bool disposing){
if(!mIsDisposed){
if(disposing){
GC.SuppressFinalize(this);
}
mIsDisposed = true;
}
}
|
|
|
|
|
could it be you're already calling StreamWriter.Close or Dispose somewhere?
maybe you should show us some of the relevant code.
|
|
|
|
|
Are you using a 'using' block by any chance? If so, it automatically calls dispose at the end of the block so manual calls to dispose will cause issues.
Another possibility is that some other object (a stream reader or similar) may be closing/disposing the underlying stream.
Just a couple of ideas as without code it's very difficult to guess what the problem is.
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier.
Please take your VB.NET out of our nice case sensitive forum.(Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
From the code below, I am getting three different errors. The first has to do with the Listbox UpdateBegin/Endupdate. The next error has to do with the 'Foreach' statement and 'in'.
private void btnLoad_Click(object sender, RoutedEventArgs e)
{
//Declare an instance of the open file dialog...
OpenFileDialog dlg = new OpenFileDialog();
//The result of the open file dialog is either true or false.
Nullable<bool>result = dlg.ShowDialog();
//Set properties for the dialog...
dlg.Title = "Select one or more media files";
dlg.Multiselect = true;
dlg.Filter = "Media files (*.mp3 | *.wav | *.wma | *.avi | *.mp4 | *.mpg | *.wmv)";
//If the result of the open file dialog was true then....
if (result == true)
{
//Stop the list box from drawing while items are added.
lstBxList.UpdateBegin(); <<
|
|
|
|
|
Tichaona J wrote: Any ideas...???
yes.
read the documentation for each of the class members you intend to use.
and pay attention to Intellisense when it is available.
|
|
|
|
|
dlg.OpenFiles is a method group
dlg.OpenFiles() is a method that returns a bunch of strings
|
|
|
|
|
Ian Shlasko wrote: a bunch of strings
streams actually, which makes it sound like a rather expensive method.
|
|
|
|
|
Ah, I was just deriving from context... So he's got more bugs buried underneath the bugs he's spotted
|
|
|
|
|
don't worry, the compiler will spot them. And we will be informed, no doubt.
|
|
|
|
|
Perhaps you could wrap your code in a PRE block and paste the exact error messages you are getting and indicate which line they are occurring on? Here's an example of how to use a PRE block:
<pre lang="C#">List<int> x = new List<int> {1, 2, 3};</pre>
Here's what that looks like:
List<int> x = new List<int> {1, 2, 3};
You can edit your original message to make that change.
|
|
|
|