Click here to Skip to main content
15,915,501 members
Home / Discussions / C#
   

C#

 
GeneralWindows form controls vanish in runtime Pin
StealthEX12-Jul-05 6:06
StealthEX12-Jul-05 6:06 
GeneralCustom Cursors disappears !!! Pin
RajeshGuptha12-Jul-05 5:42
RajeshGuptha12-Jul-05 5:42 
QuestionCan Somone answer my question? Pin
DeepToot12-Jul-05 5:38
DeepToot12-Jul-05 5:38 
AnswerRe: Can Somone answer my question? Pin
MoustafaS12-Jul-05 11:27
MoustafaS12-Jul-05 11:27 
GeneralRe: Can Somone answer my question? Pin
DeepToot12-Jul-05 11:43
DeepToot12-Jul-05 11:43 
GeneralSave image as CMYK Pin
F_A_C12-Jul-05 5:23
F_A_C12-Jul-05 5:23 
Generalpointer in C# Pin
amitmohanty12-Jul-05 4:59
amitmohanty12-Jul-05 4:59 
GeneralRe: pointer in C# Pin
Judah Gabriel Himango12-Jul-05 5:02
sponsorJudah Gabriel Himango12-Jul-05 5:02 
You can use regular old pointers in C#. You just have to do it in an unsafe context:

unsafe static void WriteLocations() 
 {
  int *p;
  int i;
  i = 10;
  p = &i;


  string addr;
  addr = int.Format((int) p, "X");
  //To Format the Pointer to a String

  Console.WriteLine(addr);
  Console.WriteLine(*p);

  *p = 333;
  Console.WriteLine(i);
  //Change the Value using Pointer

  i = *(&i) + 10;
  Console.WriteLine(i);

 }


Also, instead of marking a class or function as static, you can mark portions of code as unsafe:

void DoSomething() // safe function
{
    unsafe // unsafe block of code in safe function
    {
        // use pointers here
    }
}


Also note that the C# compiler needs the /unsafe switch turned on in order to use unsafe code.

Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Homosexuality in Christianity
Judah Himango


GeneralRe: pointer in C# Pin
amitmohanty12-Jul-05 5:10
amitmohanty12-Jul-05 5:10 
GeneralRe: pointer in C# Pin
Judah Gabriel Himango12-Jul-05 5:43
sponsorJudah Gabriel Himango12-Jul-05 5:43 
GeneralRe: pointer in C# Pin
Guffa12-Jul-05 5:53
Guffa12-Jul-05 5:53 
GeneralRe: pointer in C# Pin
amitmohanty12-Jul-05 6:03
amitmohanty12-Jul-05 6:03 
GeneralRe: pointer in C# Pin
Guffa12-Jul-05 6:45
Guffa12-Jul-05 6:45 
GeneralRe: pointer in C# Pin
amitmohanty12-Jul-05 6:49
amitmohanty12-Jul-05 6:49 
GeneralRe: pointer in C# Pin
Guffa12-Jul-05 7:39
Guffa12-Jul-05 7:39 
GeneralRe: pointer in C# Pin
3Dizard12-Jul-05 7:09
3Dizard12-Jul-05 7:09 
GeneralExcel Reporting using a Template Pin
Alomgir Miah12-Jul-05 4:34
Alomgir Miah12-Jul-05 4:34 
GeneralEventhandler Pin
pssuresh12-Jul-05 4:12
pssuresh12-Jul-05 4:12 
GeneralRe: Eventhandler Pin
S. Senthil Kumar12-Jul-05 4:39
S. Senthil Kumar12-Jul-05 4:39 
GeneralRe: Eventhandler Pin
Gavin Jeffrey12-Jul-05 4:43
Gavin Jeffrey12-Jul-05 4:43 
GeneralRe: Eventhandler Pin
Judah Gabriel Himango12-Jul-05 4:57
sponsorJudah Gabriel Himango12-Jul-05 4:57 
GeneralRe: Eventhandler Pin
J4amieC12-Jul-05 5:52
J4amieC12-Jul-05 5:52 
GeneralDatakeyfield in Datagrid Pin
livez12-Jul-05 4:07
livez12-Jul-05 4:07 
GeneralPessimistic locking Pin
rmedo12-Jul-05 3:47
rmedo12-Jul-05 3:47 
GeneralRe: Pessimistic locking Pin
Dave Kreskowiak12-Jul-05 5:56
mveDave Kreskowiak12-Jul-05 5:56 

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.