Click here to Skip to main content
15,606,446 members
Home / Discussions / C#
   

C#

 
GeneralRe: Added method with a wizard Pin
Guillermo Rivero18-Jan-04 10:32
Guillermo Rivero18-Jan-04 10:32 
GeneralC# - Multidimensionnal array of pointers Pin
Orahn18-Jan-04 7:05
Orahn18-Jan-04 7:05 
GeneralRe: C# - Multidimensionnal array of pointers Pin
leppie18-Jan-04 10:04
leppie18-Jan-04 10:04 
GeneralRe: C# - Multidimensionnal array of pointers Pin
Orahn18-Jan-04 10:09
Orahn18-Jan-04 10:09 
GeneralRe: C# - Multidimensionnal array of pointers Pin
leppie18-Jan-04 10:13
leppie18-Jan-04 10:13 
GeneralRe: C# - Multidimensionnal array of pointers Pin
Heath Stewart18-Jan-04 11:49
protectorHeath Stewart18-Jan-04 11:49 
GeneralRe: C# - Multidimensionnal array of pointers Pin
Orahn18-Jan-04 18:58
Orahn18-Jan-04 18:58 
GeneralRe: C# - Multidimensionnal array of pointers Pin
pat2918-Jan-04 18:58
pat2918-Jan-04 18:58 
Work only with value type and only 1D array.
Example:
using System;

namespace TestUnsafe
{
public class Test
{
[STAThread]
static void Main(string[] args)
{
// Reference type
Console.WriteLine("With a reference type");

TestClass [,] tcArray = new TestClass [2,2];

tcArray[0,1] = new TestClass(2);
tcArray[1,1] = new TestClass(4);
tcArray[1,1].Display();
tcArray[0,1].Display();

// Value type
TestStruct obj = new TestStruct(3);
TestStruct obj2 = new TestStruct(6);

Console.WriteLine("With a value type");
unsafe
{
TestStruct * myObj = &obj; // Value Types only
myObj->Display();
}

Console.WriteLine("With a value type 1D array");
unsafe
{
TestStruct * [] ptrArray = new TestStruct * [3]; // 1D Array only
ptrArray[0] = &obj;
ptrArray[2] = &obj2;
ptrArray[2]->Display();
Console.WriteLine("Loop in the 1D Array");
foreach (TestStruct * ptr in ptrArray)
{
if (ptr != null)
ptr->Display();
}

}

Console.WriteLine("With a value type Jagged Array");
unsafe
{
TestStruct * [][] ptrJaggedArray = new TestStruct * [2][];
ptrJaggedArray[0] = new TestStruct * [2];
ptrJaggedArray[1] = new TestStruct * [2];
ptrJaggedArray[1][1] = &obj;
ptrJaggedArray[1][1]->Display();
Console.WriteLine("Loop in the Jagged Array");
foreach (TestStruct * [] ptrArray2 in ptrJaggedArray)
{
foreach (TestStruct * ptr in ptrArray2)
{
if (ptr != null)
ptr->Display();
}
}

}

}
}

public class TestClass
{
private int data;

public TestClass (int d) { data = d; }

public void Display() { Console.WriteLine(data.ToString()); }
}

public struct TestStruct
{
private int data;
public TestStruct(int d) { data = d; }
public void Display() { Console.WriteLine(data.ToString()); }
}
}
GeneralExecuteNonQuery() problem in C# Pin
Qamarwis18-Jan-04 5:10
Qamarwis18-Jan-04 5:10 
GeneralRe: ExecuteNonQuery() problem in C# Pin
Nick Parker18-Jan-04 5:39
protectorNick Parker18-Jan-04 5:39 
GeneralRe: ExecuteNonQuery() problem in C# Pin
Guillermo Rivero18-Jan-04 6:58
Guillermo Rivero18-Jan-04 6:58 
GeneralRe: ExecuteNonQuery() problem in C# Pin
india_nagpur118-Jan-04 20:04
india_nagpur118-Jan-04 20:04 
GeneralCustomCollection + Auto code generation in designer Pin
James Simpson18-Jan-04 3:05
James Simpson18-Jan-04 3:05 
GeneralRe: CustomCollection + Auto code generation in designer Pin
Heath Stewart18-Jan-04 11:45
protectorHeath Stewart18-Jan-04 11:45 
GeneralRe: CustomCollection + Auto code generation in designer Pin
James Simpson18-Jan-04 11:50
James Simpson18-Jan-04 11:50 
Generalado.net Pin
Roger Alsing18-Jan-04 1:30
Roger Alsing18-Jan-04 1:30 
GeneralRe: ado.net Pin
Arjan Einbu18-Jan-04 4:10
Arjan Einbu18-Jan-04 4:10 
GeneralRe: ado.net Pin
Heath Stewart18-Jan-04 11:31
protectorHeath Stewart18-Jan-04 11:31 
Generalcreating a dll with win32 functions, and calling it from C# Pin
misterbear17-Jan-04 23:52
misterbear17-Jan-04 23:52 
GeneralRe: creating a dll with win32 functions, and calling it from C# Pin
Nick Parker18-Jan-04 5:47
protectorNick Parker18-Jan-04 5:47 
GeneralRe: creating a dll with win32 functions, and calling it from C# Pin
leppie18-Jan-04 6:15
leppie18-Jan-04 6:15 
GeneralRe: creating a dll with win32 functions, and calling it from C# Pin
Heath Stewart18-Jan-04 11:24
protectorHeath Stewart18-Jan-04 11:24 
GeneralRe: creating a dll with win32 functions, and calling it from C# Pin
misterbear20-Jan-04 6:51
misterbear20-Jan-04 6:51 
GeneralRe: creating a dll with win32 functions, and calling it from C# Pin
Heath Stewart20-Jan-04 8:24
protectorHeath Stewart20-Jan-04 8:24 
GeneralWeb Service Question Pin
Mazdak17-Jan-04 20:25
Mazdak17-Jan-04 20: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.