|
I haven't tried it as yet, that's why I asked for a code sample, because I want to understand.
Jon
|
|
|
|
|
Pass by value and pass by reference:
Passing mechanisms decide how changes made to the parameter affect the caller.
Consider the following code snippet
Ex:
class MyClass {
public int value;
}
class Program {
..void funcPassbyValue(MyClass obj) {
obj.value = 10;
obj = new MyClass();
obj.value = 5;
}
..void func2PassbyRef(ref MyClass obj) {
obj.value = 10;
obj = new MyClass();
obj.value = 5;
}
.. Main() {
MyClass passedObj = new MyClass();
funcPassbyValue(passedObj );
Console.WriteLine(passedObj .value); //Outputs 10
func2PassbyRef(ref passedObj );
Console.WriteLine(passedObj .value); //Outputs 5
}
}
You can see both the methods funcPassbyValue && func2PassbyRef differ only in their signature.
Things which happen in common to both the methods: Any changes made to the argument to the method will be reflected back (condition is the changes are done while the parameter - in this case obj - is not changed to refer other object).
what does funcPassbyValue do differently: any changes made to the parameter (obj) will be local within the method and will not change (change here means to make it refer other object) the passedObj to refer other object.
Hope this clears your doublt.
what does func2PassbyRefdo differently: any changes made to the parameter (obj) will be reflected back to the caller in this case passedObj is changed to refer to the new object created inside the method.
|
|
|
|
|
|
Sorry but I don't think that is going to be acceptable. You expect someone to download your code (could be malicious for all we know) and run it to find out why it does not work. That's your job, when you have identified the problem area or have an error message then come back with the details.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi all,
I search on CP how to have new posts on a message board emailed to me without success (obviously).
Yes, I know that this may get the "what does this have to do with C#", etc., but it's somewhat related. Essentially, since I have asked enough dumb C# questions, maybe now I'm beginning to have the answers to some of the other dumb C# questions that are asked and therefore I could assist. However, the bigger reason may be I don't want to miss out when someone asks a really dumb question. (of course this could be one of those
Anyway, the RSS feed option doesn't work for my present situation and email would be nice, if possible.
Thanks.
|
|
|
|
|
There are three reasons you can get an e-mail that originated in a forum:
1.
you post a message and someone posts a reply to it;
2.
you post a message, with the "Allow private email replies to this message" checkbox checked, so the "Email" widget next to the "Reply" widget is present; when pressed by someone, the reply is not published, it is emailed to you.
3.
someone posts a message on your personal blog/forum, the one on your profile page.
Conclusion: when not on your profile page, a new thread will not result in an e-mail to you. If you want to know what goes on on a forum, you have to browse the forums.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Thanks. I've been on a couple of forums in the past where you could at least get a daily email indicating new posts for the previous day.
Oh well......
|
|
|
|
|
Since there are a large number of forums on this site (there are 25 programming forums alone!) most of which receive at least one post a day, and some of which receive hundreds of posts a day, I for one am glad we don't get an auto email each day (or worse each post) to say that the forum has changed. I would never have time to read my real emails!
What about QA? Should we get am email when anything is posted there as well?
Just note the numbers in the top left: 7 Million members, 21,000 online. Notification on change is all very well with a quiet site, but here? No thanks...
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
If someone wanted to inflict themselves with a daily single email per forum that shows 100+ lines of titles for new threads, does that sound so bad?
I know my boss gets probably 25+ emails a day for enlargement techniques.
While he may continue to be frustrated, which I cannot help, I know that if I could get a single email from the C# forum I could conceivably prevent frustration.
But alas, I am also fine with searching through the threads. Just am doing it typically with a decent amount of leadtime.
|
|
|
|
|
mprice214 wrote: If someone wanted to inflict themselves with a daily single email per forum that shows 100+ lines of titles for new threads, does that sound so bad?
For that individual no.
For the poor Hamsters having to organize the Emails for, lets say 10,000, members - not so good.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
Why do programmers often confuse Halloween and Christmas?
Because 31 Oct = 25 Dec.
|
|
|
|
|
I figured the hamsters were all the silicon gates that open and close, depending on what the software guys tell them what to do.
I don't think the question was that perverse
It stems from having participated in other forums and is not a unique brain child of mine .
|
|
|
|
|
So, you get 7,000,000+ emails going out, potentially with 1000 lines of titles here (some of the forums are very active). That's a lot of infrastructure needed there. Chris and the team have enough on their plate right now (BTW - if you want to discuss something like this, you should choose the Suggestions forum).
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Uncle!
I understand it's not a "flick of the switch".
I'm not suggesting that they do that either. I initially asked how and if it could be done, that was all. Just because I had come across this functionality on other forums doesn't mean that I think CP should be shut down until it does have it.
It's not worth it to me to suggest it on the Suggestion forum.
If Luc wouldn't get all over me about removing messages, I probably would.
|
|
|
|
|
Oi. I suggest you stop this thread here and now; it has been answered and dealt with. No need to add or remove anything.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
I second that!
Do you ever sleep?
|
|
|
|
|
Most of the time, but nobody notices the difference.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Hi,
I'm using a third party class library called SmtPop.NET, to allow me to read (Pop3) and send (SMTP) email from a server.
I have this whole program working correctly when building the Debug version of the application. Only when I try and build the Release version I recieve a number of errors relating to the SmtPop reference, for example:
Error: The type or namespace name 'SmtPop' could not be found (are you missing a using directive or an assembly reference?)
I also recieve the following warning message:
Warning: Could not resolve this reference. Could not locate the assembly "smtpop". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
Does anyone know why I would recieve these messages? Or has anyone every recieved messages of this sort when trying to build a Release version of a program that inclueds a third party class library added as a referance?
Any help would be really appreciated.
Thanks,
Mel
|
|
|
|
|
Is there something you have to do with references when creating the release version of a .Net program?
|
|
|
|
|
Ok, I've been playing around with it and just happened to copy the SmpPop.dll and other related files (contained in a folder) into the folder of my project and then reattached the SmpPop.dll as a reference in my project. Rebuilt the solution, which was successful with no error.
I'm assuming that was the problem and I had to include reference dll's in the folder of your project. Correct me please if I'm wrong of if you know of an article that I can read that describes the process of a build.
Thanks,
Mel
|
|
|
|
|
|
|
Your welcome. Hope it helped.
|
|
|
|
|
Hey All,
I'm having a concept issue with DataBinding in C# and VS.NET 2010.
I have a Table, MyTable, it contains a record which is displayed in a form (all fields bound), and i have a save button.
Then I have another Table, MyTableSpecs, it contains MANY records. These all have the same key, so that the table, and the tablespecs go together. I use this relationship to bind the grid that shows the specs rows.
When a user is vieweing an existing records already in the database, everything works fine. At the top I see the fields of the MyTable row, then in the GridView I see the MyTableSpecs that match key with MyTable. when i save these, it all works.
Problem comes with creating NEW records (and Identity I don't think is the issue (The ID field of both tables is a INT, auto-incremented from 0).
But when i am creating a NEW record, I have problems. I do not want to FIRST submit the top part of the window (therefore the MyTable record) BEFORE the user enters in the child rows in the Grid. I want both the fields at the top AND the grid to be populated first, and THEN i want it to commit both in order, MyTable record first, then each MyTableSpecs rows. If the grid was not databound, I would just apply the data myself and it would work, but I want to use DataBinding, surely it can perform this task...
The problem is, once I save the top record at the top using BindingSource.EndEdit(); and then TableAdapter.Update(Data.MyTable);
ALL of the data in the MyTableSpecs Grid/BindingSource disappear!
So I can't commit them anymore... They dont stick around and get the ID itself, I dont even get the chance to APPLY them either, because the whole binding is empty.
Can someone tell me what I'm fundamentally misunderstanding, or do I have to commit the top part first, THEN let the user fill out the grid and then save the rows??? (i hate this idea, NOT user friendly)
I know I could just remove the databinding altogether, but I didn't want to have to do that...
Any help would be appreciated.
Phil
modified on Monday, June 7, 2010 5:22 PM
|
|
|
|
|
This comes from binding your data tables to the form controls using MS wizardy things and adapters. You either have to do the 2 stage save or take control of your data in some other way. The adapters work for only the most basic solution (although I would think this scenario is pretty basic so there may be a solution to it).
I would use an class representing your table that holds 1 record and a list of spec objects. Bind Mytable to the form and List<myspec> to the grid. This will allow you to let the user do basically anything you want. When the user commits the data then you could wrap the entire save operation in a transaction ans save MyTable and getting the ID generated by the database (use parameterised queries) and then saving MySpec with the ID then committing the transaction.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Yeah see, your solution is more or less "doing it myself" which I know would be fairly simple.
The system works great if you aren't binding EVERYTHING, but the bindings make create the UI really easy at first.
I have completed the modifications to create and save the top record even if the user may CANCEL it. This seems to be the easiest solution WITH bindings.
The thing is, i have no choice, i'm being told to use bindings and i cannot "do it myself" so to speak.
Thanks for the try though, I appreciate it muchly.
Phil
|
|
|
|
|