|
This is strange indeed. The compiler also complains when using the unchecked keyword.
I googled a bit and found out that ldc only supports i4, i8, r4 and r8 as parameters (i=int, r=float), which would mean that Int16 are internally interpreted as Int32 , can anyone confirm this?
The "ldc" instruction can support a 4-byte integer (i4), an 8-byte integer (i8), a 4-byte float (r4) or an 8-byte float (r8).
-> source
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
That makes sense considering processor registers, supported by the .NET Framework, are either 32 or 64 bits wide.
According to the documentation for the LDC_I4[^] and LDC_I8[^] opcodes, yes, this is the case. Integers of any size are stored in either 4 or 8 bytes.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
short s are promoted - converted - to int s before performing calculations. This is true in C and C++ as well as in C#. Therefore the type of 'a + b' is Int32 . When you then try to assign the result of the expression (which is Int32 ) back to an Int16 , there's a type mismatch, which produces the error message.
|
|
|
|
|
I have this code:
Stream s = File.Open(@destinationDirectory + tableName + ".cs", FileMode.Create);
StreamWriter sw = new StreamWriter(s);
CodeGeneratorOptions cop = new CodeGeneratorOptions();
CodeNamespace cdm = new CodeNamespace(nameSpace);
CSharpCodeProvider cscProvider = new CSharpCodeProvider();
ICodeGenerator cscg = cscProvider.CreateGenerator(sw);
CodeTypeDeclaration ctd = new CodeTypeDeclaration(tableName);
ctd.IsClass = true;
ctd.TypeAttributes = System.Reflection.TypeAttributes.Public;
This works just fine for creating the class.
But, I want to declare this a partial class for this reason. I have a main code file with methods and what not. But, I am creating the properties for the class dynamically. So I want this class to be a partial class file that is never opened and can be replaced any time.
So I need to say "public partial class". Does anyone know how?
Thanks,
Nick
--------------------------------------------------------
1 line of code equals many bugs. So don't write any!!
My mad coder blog
|
|
|
|
|
nevermind, its a boolean property in the code type declaration
--------------------------------------------------------
1 line of code equals many bugs. So don't write any!!
My mad coder blog
|
|
|
|
|
Happens to me all the time: ask a question to which I didn't bother enough/was too deep thinking to quickly find the answer myself.
Best regards...
Vini - Csharpian
|
|
|
|
|
Hello,
I have been trying to modify the available .NET WMI examples on The Code Project so that I could uniquely identify a pen-drive (usb key). Unlike the hard disks, pen drives do not expose a property like UniqueID. Any ideas of what I could use to uniquely identify it?
I have already read and tried the "normal" examples available on .NET's WMI.
Thank you all in advance,
Vini - CSharping a lot
|
|
|
|
|
Hi!
I think Win32_DiskDrive.PNPDeviceID is unique. I tried it with two idential usb sticks and they gave different PNPDeviceID's.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
mav.northwind wrote: Hi!
I think Win32_DiskDrive.PNPDeviceID is unique. I tried it with two idential usb sticks and they gave different PNPDeviceID's.
Hi Mav... Tried that but unfortunately I think I couldn't use that, as windows gives your pen-drive a different PNPDeviceID each time you plug it in. =) I needed something that could tell "Oh, this is Jimmy's pen-drive" for instance. I am developing an app in which, along with user and password, the client system has to provide an unique ID for the pen-drive being used with the app. Any other ideas?
Regards...
Vini
|
|
|
|
|
You might be able to gleen something useful from this[^].
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
ReHi!
At least with the 4 sticks (3 different brands) I tried it with, they all kept their PNPDeviceID, even when I plugged them into another computer.
But your mileage may vary...
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
mav.northwind wrote: At least with the 4 sticks (3 different brands) I tried it with, they all kept their PNPDeviceID, even when I plugged them into another computer.
But your mileage may vary...
You're quite right, mav... Looking through msinfo32.exe I could check that it remains the same, actually. I also tested on another workstation.
Thanks a lot for your help.
And btw: the link that Dave (if Im not wrong) posted is very nice. If you wanna take a peek:
http://msdn.microsoft.com/coding4fun/someassemblyrequired/isthatyou/default.aspx
Cheers,
|
|
|
|
|
Marcos Accioly wrote: And btw: the link that Dave (if Im not wrong) posted is very nice. If you wanna take a peek:
http://msdn.microsoft.com/coding4fun/someassemblyrequired/isthatyou/default.aspx
Yup, I already browsed through it. Very nice, indeed.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Hi again mav,
I actually tried the PNPDeviceID for my LG UP3D USB Device and it simply informed nothing. *But* going to msinfo32.exe gives me the following output:
LG UP3D USB Device USBSTOR\DISK&VEN_LG_UP3D&PROD_&REV_\200508010001&0
USB Mass Storage Device USB\VID_043E&PID_7090\200508010001
which tells me that windows actually has a PNPDeviceId for it, that being VID_043E&PID_7090 (according to the article at Coding4Fun about the wireless usb PC Lock).
Now the question is: Why?
you can check out a printscreen I've done of the simple app for identifying the hardware HERE
Cheers,
Vini
|
|
|
|
|
The wonders of windows...
I'm afraid I don't have the faintest idea why
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
hi there,
I have the following MATLAB function:
function y=drwmesh(FNo,V1,V2,T)
figure(FNo)
x=[-10:2.5:60]; y=[-20:2.5:35];
[sx sy]=MESHGRID(-10:60,-20:35);
h=STREAMLINE(V1',V2',sx,sy);
set(h,'color','red'); view(2);
xlabel('Longitude'); ylabel('Latitude');
title(T);
y=0;
I have converted it to (.dll) file by using MATLAB Builder for COM.
My problem is that I don't know how to pass the parameters: FNo(Figure No.) which is integer and the two matrices V1,V2 and the string T.
Woudl u plz write me the C# code? plz help me!!
Note: I'm using "Extreme Optimization Mathematics Library for .NET" to creat and perform matrix operatins.
Thanks in advance,
Jr.Allam
|
|
|
|
|
Hi,
If i send a comman to a device which is attached to my serial port.
How can i save the response i get?
Thanks in advance!
|
|
|
|
|
Yustme wrote: How can i save the response i get?
Create a file and write the data to the file
led mike
|
|
|
|
|
You have to register an event in the serialport class like this
SPort.DataReceived += new SerialDataReceivedEventHandler(SPort_DataReceived);
In the eventhandler you can read the data in the buffer by char or by the whole string using the following methods
ReadChar()
ReadExisting();
|
|
|
|
|
Hello,
Just i want to ask you that can we set system's default sound device through
programmitically.
I just explore my questions as, I have two sound cards connected to my pc.
One is my inbuilt and i have connected anothor USB sound card to PC.
Now, the inbuild sound card in my default sound card and i want to make second one
i.e. i want to make USB sound card as default when my application starts and when application is
shutting down i want to make it as default.
Thanks in advance.
Rahul Kulkarni.
|
|
|
|
|
Hello
you should be looking Here[^]
Regards
|
|
|
|
|
How to move e-mail item from inbox folder to another folder (backup) Using Microsoft Outlook 2002, in C# ?
Thanks!
Manoel Bonin
|
|
|
|
|
Hi everybody.
I use Visual C# w managed DirectX to load the mesh. It looks fine, but the
edges are raugh. When I adjust the light, it looks somewhat better, but it is
still not good. I tried changing the camera near and far plain, making the
object bigger so more pixels are used to render the object, removed all other
objects from the scene so Z-fighting would not be the issue, but to no avail.
When I load the mesh into 3DS Max it looks perfect, so it is not the object
itself. The edges look as if not being antialiased, but I have no clue how to
go with this.
Any help would be appreciated.
Thanks.
|
|
|
|
|
hi, was hoping to get some help with a problem of mine.
i get an error when i run this saying that Control.Invoke is required.
However i want to avoid using delegates since it eats up a lot of resources.
how do i do this?
is it even possible?
thanks!
|
|
|
|
|
Hello
lushgrass wrote: i get an error when i run this
What is this exactly??!
lushgrass wrote: i want to avoid using delegates since it eats up a lot of resources.
Who on earth said that?!!
lushgrass wrote: is it even possible?
Depends on what you are trying to do?? Some details and a bit of code will be very helpful.
Regards
|
|
|
|