Click here to Skip to main content
15,887,135 members
Home / Discussions / C#
   

C#

 
QuestionDiv Mod SQL Pin
TAREQ F ABUZUHRI3-Sep-06 22:03
TAREQ F ABUZUHRI3-Sep-06 22:03 
AnswerRe: Div Mod SQL Pin
mikone3-Sep-06 22:42
mikone3-Sep-06 22:42 
AnswerRe: Div Mod SQL Pin
John Petersen3-Sep-06 23:07
John Petersen3-Sep-06 23:07 
QuestionWindows service Pin
scharnier3-Sep-06 21:39
scharnier3-Sep-06 21:39 
AnswerRe: Windows service Pin
Jonathan van de Veen4-Sep-06 1:29
Jonathan van de Veen4-Sep-06 1:29 
AnswerRe: Windows service Pin
mav.northwind4-Sep-06 3:55
mav.northwind4-Sep-06 3:55 
AnswerRe: Windows service Pin
scharnier4-Sep-06 21:02
scharnier4-Sep-06 21:02 
QuestionPointers in C# Pin
mikone3-Sep-06 21:35
mikone3-Sep-06 21:35 
Hi,
i need something similar to a pointer in C#. C# itself has pointers implemented but they do not fit my needs.

I want to "map" a Variable to another one, in two different objects of a different class.

Pointing to a variable of a "user-defined" type is not a problem but pointing to a "managed" type is. It doesn't let me point to strins, integers or other built-in datatypes.

Thats why pointers do not work in my case - do you know any workaround for making the pointers work as i want them to or do you know another possibility to realize this?

Here is a little example of what i want to be able to do:

<br />
class MyClass<br />
{<br />
   public int AValue = null;<br />
}<br />
<br />
class AnotherClass<br />
{<br />
   public int * APointerToAValue = null;<br />
<br />
   public AnotherClass(ref int MappingVar)<br />
   {<br />
       unsafe<br />
       {<br />
           fixed (int * tmpptr = &MappingVar)<br />
           {<br />
              APointerToAValue = tmpptr;<br />
           }<br />
       }<br />
   }<br />
}<br />


Now when executing the following code

<br />
MyClass MyObj = new MyClass();<br />
AnotherClass AnotherObj = new AnotherClass(ref MyObj.AValue);<br />
<br />
AnotherObj.APointerToAValue = 3<br />
Console.WriteLine("Pointer: " + AnotherObj.APointerToAValue.ToString());<br />
Console.WriteLine("Value: " + MyObj.AValue.ToString());<br />
<br />
MyObj.AValue = 4<br />
Console.WriteLine("Pointer: " + AnotherObj.APointerToAValue.ToString());<br />
Console.WriteLine("Value: " + MyObj.AValue.ToString());<br />


this result should be produced:

<br />
Pointer: 3<br />
Value: 3<br />
Pointer: 4<br />
Value: 4<br />


Is there any way to manage it like this in C#? It doesn't has to be realized with pointers at all i just need a solution for the given problem!
AnswerRe: Pointers in C# Pin
Guffa3-Sep-06 22:01
Guffa3-Sep-06 22:01 
GeneralRe: Pointers in C# Pin
mikone3-Sep-06 22:25
mikone3-Sep-06 22:25 
AnswerRe: Pointers in C# Pin
Guffa4-Sep-06 19:09
Guffa4-Sep-06 19:09 
Questionhow to add txt box data to Janus GridEx ?? Pin
sikandarhayat3-Sep-06 21:14
sikandarhayat3-Sep-06 21:14 
AnswerRe: how to add txt box data to Janus GridEx ?? Pin
WillemM4-Sep-06 0:49
WillemM4-Sep-06 0:49 
QuestionAbout Unicode character [modified] Pin
mariodai3653-Sep-06 21:08
mariodai3653-Sep-06 21:08 
AnswerRe: About Unicode character Pin
Guffa3-Sep-06 22:05
Guffa3-Sep-06 22:05 
GeneralRe: About Unicode character Pin
mariodai3653-Sep-06 23:24
mariodai3653-Sep-06 23:24 
QuestionWMI Windows Installer Provider on win2003 Pin
abhinish3-Sep-06 20:47
abhinish3-Sep-06 20:47 
QuestionPrintScreen Pin
MHASSANF3-Sep-06 20:38
MHASSANF3-Sep-06 20:38 
AnswerRe: PrintScreen Pin
Divyang Mithaiwala3-Sep-06 21:49
Divyang Mithaiwala3-Sep-06 21:49 
QuestionMake Setup of C# Project Pin
M Riaz Bashir3-Sep-06 20:33
M Riaz Bashir3-Sep-06 20:33 
AnswerRe: Make Setup of C# Project Pin
MHASSANF3-Sep-06 20:45
MHASSANF3-Sep-06 20:45 
QuestionGet Windows System directory [modified] Pin
freshonlineMax3-Sep-06 20:16
freshonlineMax3-Sep-06 20:16 
AnswerRe: Get Windows System directory Pin
abhinish3-Sep-06 20:34
abhinish3-Sep-06 20:34 
AnswerRe: Get Windows System directory Pin
Nader Elshehabi4-Sep-06 1:55
Nader Elshehabi4-Sep-06 1:55 
AnswerRe: Get Windows System directory Pin
Scott Dorman6-Sep-06 21:25
professionalScott Dorman6-Sep-06 21:25 

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.