Click here to Skip to main content
15,886,799 members
Home / Discussions / C#
   

C#

 
AnswerRe: C# PinPopular
Richard MacCutchan14-Jul-13 22:26
mveRichard MacCutchan14-Jul-13 22:26 
GeneralRe: C# Pin
Rain Dancer15-Jul-13 23:42
Rain Dancer15-Jul-13 23:42 
AnswerRe: C# Pin
Emmanuel Medina15-Jul-13 11:55
professionalEmmanuel Medina15-Jul-13 11:55 
AnswerRe: C# Pin
Abhinav S15-Jul-13 18:37
Abhinav S15-Jul-13 18:37 
AnswerRe: C# Pin
Amir Mohammad Nasrollahi29-Jul-13 6:53
professionalAmir Mohammad Nasrollahi29-Jul-13 6:53 
GeneralRe: C# Pin
Rain Dancer2-Oct-13 4:41
Rain Dancer2-Oct-13 4:41 
QuestionC# Class Design Pin
jimbo6914-Jul-13 18:03
jimbo6914-Jul-13 18:03 
AnswerRe: C# Class Design Pin
OriginalGriff14-Jul-13 20:42
mveOriginalGriff14-Jul-13 20:42 
The problem is the ref requirement:
From the C# specification:

"When a formal parameter is a reference parameter, the corresponding argument in a method invocation must consist of the keyword ref followed by a variable-reference (§12.3.3) of the same type as the formal parameter"
http://www.jaggersoft.com/csharp_standard/17.5.1.2.htm[^]

And the problem is that your type isn't exactly the same type - it's derived. And you can't take a ref of a cast of a variable to prevent you from accidently changing the parameter to a different derived class from the same base and passing it back...

C#
public void BuggerItUp(ref Control c)
   {
   c = new Label();
   }
...
   DataGridView dgv = new DataGridView();
   BuggerItUp(ref (Control) dgv)
   // What happens when you use dgv here?

Do you really need the ref here?
The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)

GeneralRe: C# Class Design Pin
jimbo6915-Jul-13 4:44
jimbo6915-Jul-13 4:44 
GeneralRe: C# Class Design Pin
OriginalGriff15-Jul-13 5:00
mveOriginalGriff15-Jul-13 5:00 
AnswerRe: C# Class Design Pin
Bernhard Hiller15-Jul-13 3:05
Bernhard Hiller15-Jul-13 3:05 
GeneralRe: C# Class Design Pin
jimbo6915-Jul-13 4:45
jimbo6915-Jul-13 4:45 
Questionc# Pin
akoito114-Jul-13 16:52
akoito114-Jul-13 16:52 
AnswerRe: c# Pin
OriginalGriff14-Jul-13 20:05
mveOriginalGriff14-Jul-13 20:05 
QuestionHow to dispose all resources after closing the application ? Pin
taibc13-Jul-13 23:26
taibc13-Jul-13 23:26 
AnswerRe: How to dispose all resources after closing the application ? Pin
Eddy Vluggen14-Jul-13 2:45
professionalEddy Vluggen14-Jul-13 2:45 
GeneralRe: How to dispose all resources after closing the application ? Pin
taibc14-Jul-13 15:04
taibc14-Jul-13 15:04 
GeneralRe: How to dispose all resources after closing the application ? PinPopular
NotPolitcallyCorrect14-Jul-13 15:30
NotPolitcallyCorrect14-Jul-13 15:30 
GeneralRe: How to dispose all resources after closing the application ? Pin
Dave Kreskowiak14-Jul-13 15:34
mveDave Kreskowiak14-Jul-13 15:34 
GeneralRe: How to dispose all resources after closing the application ? Pin
jschell15-Jul-13 8:42
jschell15-Jul-13 8:42 
GeneralRe: How to dispose all resources after closing the application ? Pin
Dave Kreskowiak15-Jul-13 10:03
mveDave Kreskowiak15-Jul-13 10:03 
GeneralRe: How to dispose all resources after closing the application ? Pin
jschell16-Jul-13 8:10
jschell16-Jul-13 8:10 
GeneralRe: How to dispose all resources after closing the application ? Pin
Dave Kreskowiak16-Jul-13 9:28
mveDave Kreskowiak16-Jul-13 9:28 
GeneralRe: How to dispose all resources after closing the application ? Pin
jschell17-Jul-13 8:37
jschell17-Jul-13 8:37 
GeneralRe: How to dispose all resources after closing the application ? Pin
Dave Kreskowiak17-Jul-13 9:27
mveDave Kreskowiak17-Jul-13 9:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.