Click here to Skip to main content
15,897,519 members
Home / Discussions / C#
   

C#

 
Questionshow a webcam photo Pin
naghoumeh1415-Feb-10 0:21
naghoumeh1415-Feb-10 0:21 
AnswerRe: show a webcam photo Pin
Nematjon Rahmanov15-Feb-10 0:33
Nematjon Rahmanov15-Feb-10 0:33 
GeneralRe: show a webcam photo Pin
naghoumeh1415-Feb-10 0:59
naghoumeh1415-Feb-10 0:59 
GeneralRe: show a webcam photo Pin
Nematjon Rahmanov15-Feb-10 1:31
Nematjon Rahmanov15-Feb-10 1:31 
Question[NOT SOLVED ANYMORE] Renaming fields / Controlling access to fields [modified] Pin
blackblizzard15-Feb-10 0:10
blackblizzard15-Feb-10 0:10 
AnswerRe: Renaming fields / Controlling access to fields Pin
Luc Pattyn15-Feb-10 0:32
sitebuilderLuc Pattyn15-Feb-10 0:32 
GeneralRe: Renaming fields / Controlling access to fields Pin
blackblizzard15-Feb-10 1:15
blackblizzard15-Feb-10 1:15 
QuestionThe suggested solution doesn't work: help, please Pin
blackblizzard22-Feb-10 3:23
blackblizzard22-Feb-10 3:23 
I didn't have time to try your suggestion until now, but now that have I've run into some serious issues. If anyone can give me some insight I'd really appreciate it. I explain the problems I've encountered with each approach I've tried:

1) I tried doing as you suggested and having the programmer use auto-implemented properties, like this:
public int x {get; set;}

But then I have found no way to dynamically modify the accessors' code, which was the whole point. The only thing I can do is get the MethodInfo of the accessor, but as far as I can see there is no way to get a MethodBuilder from that, so I can't modify anything. Is there something I'm missing?

2) I tried not having the programmer use auto-implemented properties and just define the fields like this:
private int x;

And then I went in and tried to add a property with the same name as the field (x), to do as if the programmer had declared the field+property like this:
public int x {get; set;}

And then work from there, this time having the MethodBuilder and being able to work with the code.
Of course, this doesn't work. The surprising thing is I don't get an exception when add the property, despite the fact that I'm declaring two symbols (the field and the property) with the exact same name in the same namespace. I don't know how that's possible, and if I do that by hand (i.e., writing the following code) I get a compiler error, as would be expected.
private int x;
public int x {get; set;}

If I add it dynamically (with DefineProperty) it simply doesn't seem to have any effect.
Ideally this would be the solution I'd like to use, as it requires no effort from the programmer, but I don't see how I can get this to work.

The thing is I need the programmer to be able to write their code normally, and then I'll fix the accessors so that it's safe. For them to able to write normally, I need to create properties that have the same name as the fields they declared, or have them declare automatic properties and then somehow I'll add code to the accessors.

This is crucial for my project. Is it possible at all?
Thanks a lot.
AnswerRe: The suggested solution doesn't work: help, please Pin
Luc Pattyn22-Feb-10 10:49
sitebuilderLuc Pattyn22-Feb-10 10:49 
GeneralRe: The suggested solution doesn't work: help, please Pin
blackblizzard22-Feb-10 22:38
blackblizzard22-Feb-10 22:38 
GeneralRe: The suggested solution doesn't work: help, please Pin
blackblizzard25-Feb-10 22:03
blackblizzard25-Feb-10 22:03 
QuestionComboBox Column Pin
spankyleo12314-Feb-10 23:49
spankyleo12314-Feb-10 23:49 
AnswerRe: ComboBox Column Pin
Abhinav S15-Feb-10 0:52
Abhinav S15-Feb-10 0:52 
GeneralRe: ComboBox Column Pin
spankyleo12315-Feb-10 1:33
spankyleo12315-Feb-10 1:33 
GeneralRe: ComboBox Column Pin
Abhinav S15-Feb-10 2:36
Abhinav S15-Feb-10 2:36 
GeneralRe: ComboBox Column Pin
spankyleo12315-Feb-10 3:26
spankyleo12315-Feb-10 3:26 
GeneralRe: ComboBox Column Pin
Abhinav S15-Feb-10 6:53
Abhinav S15-Feb-10 6:53 
QuestionWhich is the best printing in ASP.NET Pin
sharad Pyakurel14-Feb-10 23:41
sharad Pyakurel14-Feb-10 23:41 
AnswerRe: Which is the best printing in ASP.NET Pin
DaveAuld15-Feb-10 4:44
professionalDaveAuld15-Feb-10 4:44 
QuestionProcess Exit problem ! Pin
Nematjon Rahmanov14-Feb-10 23:01
Nematjon Rahmanov14-Feb-10 23:01 
AnswerRe: Process Exit problem ! Pin
Luc Pattyn14-Feb-10 23:10
sitebuilderLuc Pattyn14-Feb-10 23:10 
QuestionRe: Process Exit problem ! Pin
Nematjon Rahmanov14-Feb-10 23:32
Nematjon Rahmanov14-Feb-10 23:32 
AnswerRe: Process Exit problem ! Pin
Luc Pattyn14-Feb-10 23:43
sitebuilderLuc Pattyn14-Feb-10 23:43 
QuestionRe: Process Exit problem ! Pin
Nematjon Rahmanov15-Feb-10 0:17
Nematjon Rahmanov15-Feb-10 0:17 
AnswerRe: Process Exit problem ! Pin
Luc Pattyn15-Feb-10 0:24
sitebuilderLuc Pattyn15-Feb-10 0:24 

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.