Click here to Skip to main content
15,893,381 members
Home / Discussions / C#
   

C#

 
AnswerRe: Hide window in taskbar Pin
Calla29-Sep-09 22:02
Calla29-Sep-09 22:02 
AnswerRe: Hide window in taskbar Pin
freakyit29-Sep-09 22:05
freakyit29-Sep-09 22:05 
GeneralRe: Hide window in taskbar Pin
Calla29-Sep-09 22:09
Calla29-Sep-09 22:09 
GeneralRe: Hide window in taskbar Pin
polycom12329-Sep-09 22:29
polycom12329-Sep-09 22:29 
GeneralRe: Hide window in taskbar Pin
Paramhans Dubey29-Sep-09 22:40
professionalParamhans Dubey29-Sep-09 22:40 
GeneralRe: Hide window in taskbar Pin
polycom12329-Sep-09 23:36
polycom12329-Sep-09 23:36 
Questionreading Outlook Calendar in C Pin
Jassim Rahma29-Sep-09 21:52
Jassim Rahma29-Sep-09 21:52 
AnswerRe: reading Outlook Calendar in C Pin
Christian Graus29-Sep-09 22:08
protectorChristian Graus29-Sep-09 22:08 
Questionhelp needed for voip Pin
aamirzada29-Sep-09 21:31
aamirzada29-Sep-09 21:31 
AnswerRe: help needed for voip Pin
Calla29-Sep-09 22:07
Calla29-Sep-09 22:07 
GeneralRe: help needed for voip Pin
aamirzada29-Sep-09 22:23
aamirzada29-Sep-09 22:23 
GeneralRe: help needed for voip Pin
J4amieC29-Sep-09 23:38
J4amieC29-Sep-09 23:38 
GeneralRe: help needed for voip Pin
aamirzada30-Sep-09 0:44
aamirzada30-Sep-09 0:44 
AnswerRe: help needed for voip Pin
Christian Graus29-Sep-09 22:10
protectorChristian Graus29-Sep-09 22:10 
Questiondetect javascript code for google ad sense Pin
Anil Veeraghattapu 429-Sep-09 21:29
Anil Veeraghattapu 429-Sep-09 21:29 
AnswerRe: detect javascript code for google ad sense Pin
benjymous29-Sep-09 21:50
benjymous29-Sep-09 21:50 
GeneralRe: detect javascript code for google ad sense Pin
Anil Veeraghattapu 429-Sep-09 22:55
Anil Veeraghattapu 429-Sep-09 22:55 
GeneralRe: detect javascript code for google ad sense Pin
benjymous30-Sep-09 1:04
benjymous30-Sep-09 1:04 
QuestionHow to define an inline array of a contstant size in a C# structure Pin
maheesh29-Sep-09 21:13
maheesh29-Sep-09 21:13 
AnswerRe: How to define an inline array of a contstant size in a C# structure Pin
Luc Pattyn30-Sep-09 0:45
sitebuilderLuc Pattyn30-Sep-09 0:45 
Hi,

some comments/questions:

1.
if you get an exception, you should provide all the information about it.

2.
with a using System.Runtime.InteropServices; statement at the top, you don't need to fully qualify all the Marshal attributes.

3.
why do you define your struct twice? and differently?

4.
most often a struct gets a constructor, taking some parameters, and initializing all members. So you don't really need a Create() method.

5.
your code, and several variations on it, work for me. as in:
[StructLayoutAttribute(LayoutKind.Sequential)]
public struct tPacket {    
	/// WORD->unsigned short    
	public ushort word1;    
	/// WORD->unsigned short    
	public ushort word2;    
	/// BYTE->unsigned char    
	public byte byte1;   
	 /// BYTE->unsigned char   
	 public byte byte2;    
	/// BYTE[8]
	[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst=8, ArraySubType=UnmanagedType.I1)]   
	public byte[] array123;

	public static tPacket Create() {       
		return new tPacket() { array123 = new byte[8] };
	}
}
...
	tPacket p=tPacket.Create();
	for (byte i=0; i<8; i++) p.array123[i]=i;


6.
For readability code needs indentation. And PRE tags tend to preserve such formatting.

Smile | :)

Luc Pattyn

Local announcement (Antwerp region): Lange Wapper? Neen!


GeneralRe: How to define an inline array of a contstant size in a C# structure Pin
maheesh30-Sep-09 2:42
maheesh30-Sep-09 2:42 
GeneralRe: How to define an inline array of a contstant size in a C# structure Pin
Luc Pattyn30-Sep-09 2:56
sitebuilderLuc Pattyn30-Sep-09 2:56 
GeneralRe: How to define an inline array of a contstant size in a C# structure Pin
maheesh30-Sep-09 3:35
maheesh30-Sep-09 3:35 
GeneralRe: How to define an inline array of a contstant size in a C# structure Pin
Luc Pattyn30-Sep-09 3:49
sitebuilderLuc Pattyn30-Sep-09 3:49 
Questionhow to convert bmp image to hexa conversion ??? Pin
JC.KaNNaN29-Sep-09 21:02
JC.KaNNaN29-Sep-09 21:02 

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.