Click here to Skip to main content
15,902,299 members
Home / Discussions / C#
   

C#

 
GeneralRe: find a record Pin
Alex Korchemniy25-Sep-04 12:44
Alex Korchemniy25-Sep-04 12:44 
GeneralDigi cam wizard Pin
Alex Korchemniy25-Sep-04 12:25
Alex Korchemniy25-Sep-04 12:25 
GeneralDifference between 2 datetime Pin
Apusnaias25-Sep-04 11:48
Apusnaias25-Sep-04 11:48 
GeneralRe: Difference between 2 datetime Pin
Alex Korchemniy25-Sep-04 12:28
Alex Korchemniy25-Sep-04 12:28 
GeneralRe: Difference between 2 datetime Pin
Apusnaias25-Sep-04 12:44
Apusnaias25-Sep-04 12:44 
GeneralRe: Difference between 2 datetime Pin
Roland Bär29-Sep-04 3:39
Roland Bär29-Sep-04 3:39 
Generalsaving a sequence of gif images in a single file Pin
hudhud25-Sep-04 10:15
hudhud25-Sep-04 10:15 
GeneralHelp needed.....Writing a Swap function using pointer variables... Pin
Kiran Satish25-Sep-04 9:44
Kiran Satish25-Sep-04 9:44 
Hi all,

I am writing a function in C#, which is a method in a class to swap two integers which are the data members of the class. I think pointers must be used only in an unsafe context.
can anyone tell me how to define unsafe context in my problem...here is the function.

using System;
using System.Drawing;
using System.Drawing.Imaging;

namespace SpineAnalyzer
{
public class ConvMatrix
{ --- members initialisation----

public void Swap(int *x, int *y)
{
int temp;
temp=*x;
*x=*y;
*y=temp;
}

public void Flip_Hor()
{
Swap(&TopLeft11,&BottomLeft31);
Swap(&TopLeft12,&BottomLeft32);
Swap(&TopLeft13,&BottomLeft33);
Swap(&TopLeft21,&BottomLeft21);
Swap(&TopLeft22,&BottomLeft22);
Swap(&TopLeft23,&BottomLeft23);
Swap(&TopLeft31,&BottomLeft11);
Swap(&TopLeft32,&BottomLeft12);
Swap(&TopLeft33,&BottomLeft13);
Swap(&TopMid1,&BottomMid3);
Swap(&TopMid2,&BottomMid2);
Swap(&TopMid3,&BottomMid1);
Swap(&TopRight11,&BottomRight31);
Swap(&TopRight12,&BottomRight32);
Swap(&TopRight13,&BottomRight33);
Swap(&TopRight21,&BottomRight21);
Swap(&TopRight22,&BottomRight22);
Swap(&TopRight23,&BottomRight23);
Swap(&TopRight31,&BottomRight11);
Swap(&TopRight32,&BottomRight12);
Swap(&TopRight33,&BottomRight13);
}

public void Flip_Ver()
{
Swap(&TopLeft11,&TopRight13);
Swap(&TopLeft12,&TopRight12);
Swap(&TopLeft13,&TopRight11);
Swap(&TopLeft21,&TopRight23);
Swap(&TopLeft22,&TopRight22);
Swap(&TopLeft23,&TopRight21);
Swap(&TopLeft31,&TopRight33);
Swap(&TopLeft32,&TopRight32);
Swap(&TopLeft33,&TopRight31);
Swap(&MidLeft1,&MidRight3);
Swap(&MidLeft2,&MidRight2);
Swap(&MidLeft3,&MidRight1);
Swap(&BottomLeft11,&BottomRight13);
Swap(&BottomLeft12,&BottomRight12);
Swap(&BottomLeft13,&BottomRight11);
Swap(&BottomLeft21,&BottomRight23);
Swap(&BottomLeft22,&BottomRight22);
Swap(&BottomLeft23,&BottomRight21);
Swap(&BottomLeft31,&BottomRight33);
Swap(&BottomLeft32,&BottomRight32);
Swap(&BottomLeft33,&BottomRight31);
}

public void Flip_Hor_Ver()
{
Flip_hor();
Flip_ver();
}

}

here is the error i'm getting

:-Pointers may only be used in an unsafe context

can anybody help in how to implement pointer for my function and how to call from other methods of the same class.

thanks in advance,
Pavan.


Suman
GeneralRe: Help needed.....Writing a Swap function using pointer variables... Pin
Colin Angus Mackay25-Sep-04 14:59
Colin Angus Mackay25-Sep-04 14:59 
GeneralRe: Help needed.....Writing a Swap function using pointer variables... Pin
Kiran Satish25-Sep-04 19:18
Kiran Satish25-Sep-04 19:18 
GeneralProblem Solved Pin
Kiran Satish25-Sep-04 19:50
Kiran Satish25-Sep-04 19:50 
GeneralConverting byte[] to string Pin
João Paulo Figueira25-Sep-04 9:20
professionalJoão Paulo Figueira25-Sep-04 9:20 
GeneralRe: Converting byte[] to string Pin
Alex Korchemniy25-Sep-04 10:13
Alex Korchemniy25-Sep-04 10:13 
GeneralRe: Converting byte[] to string Pin
Tristan Rhodes25-Sep-04 11:32
Tristan Rhodes25-Sep-04 11:32 
GeneralRe: Converting byte[] to string Pin
Alex Korchemniy25-Sep-04 12:10
Alex Korchemniy25-Sep-04 12:10 
GeneralRe: Converting byte[] to string Pin
Tristan Rhodes26-Sep-04 4:20
Tristan Rhodes26-Sep-04 4:20 
GeneralRe: Converting byte[] to string Pin
João Paulo Figueira25-Sep-04 23:50
professionalJoão Paulo Figueira25-Sep-04 23:50 
GeneralObtaining Font Size (Pixel / EM) from COM Caption Logfont Struct Pin
Tristan Rhodes25-Sep-04 8:25
Tristan Rhodes25-Sep-04 8:25 
Generalmemory increase Pin
tifa25-Sep-04 8:16
tifa25-Sep-04 8:16 
GeneralRe: memory increase Pin
Alex Korchemniy25-Sep-04 13:06
Alex Korchemniy25-Sep-04 13:06 
GeneralRe: memory increase Pin
Colin Angus Mackay25-Sep-04 15:03
Colin Angus Mackay25-Sep-04 15:03 
General.Net Remoting Issue Pin
jtmtv1825-Sep-04 7:56
jtmtv1825-Sep-04 7:56 
GeneralRe: .Net Remoting Issue Pin
Alex Korchemniy25-Sep-04 12:34
Alex Korchemniy25-Sep-04 12:34 
GeneralRe: .Net Remoting Issue Pin
jtmtv1825-Sep-04 17:51
jtmtv1825-Sep-04 17:51 
Generalretreiving hardware information Pin
alanazi25-Sep-04 4:46
alanazi25-Sep-04 4:46 

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.