|
I think types are powerfull. I can imagine you ask this question if you're used to writing PHP, i wrote PHP and Perl and asked the same question for myself years ago. At first i thought types were annoying having to cast types over and over again. I accepted the concept of types and neatly switched the 'Option Strict' option in my VB Developement environment on and learned how to deal with types. Now writing C# there's no way around them and I think that's a good thing!
For example let's use an integer, you want a user to enter an integer somewhere in your application. You place a textbox on your (web)form and wait for the user to confirm his input. Obviously you check the user's input for example using a regular expression, or you just try to parse the input to an integer using int.TryParse (one of the quickest methods). Once your test succeeds you can actually parse the string type to an integer (TryParse already does that for you) which fills your integer variable with a certain value. There's no way the integer's value changes without having a numeric value. In PHP you could give your variable the value of the user's input, but that doesn't guarantee that value is actually a numeric value (integer). Types DO guarantee the values of those types. Same for all diffrent kinds of types. There's no way a certain type bacomes a diffrent type without actually casting them to a diffrent type. This prevents loads of errors and a hell of a debug job once an error occures somewhere in your app.
|
|
|
|
|
Hi Vijay,
I am also having some exp. in PHP and in .NET more than 3.5 Yrs. So comparing both I can say that defining data types makes remarkable difference in performance. If you do not have datatypes, then every variable will occupy the same memory space in spite of its actual size. For example, if you have boolean variable as result which will be either true or false, storing it as object or var (in terms of VB) wil occupy the same space that will be occupied by a double or string. So you will always appreciate to use 1 byte instead of using 16 bytes.
The most important function of CLR is to manage memory in the most optimized way. That's the way .NET optimizes applications and provides memory level security by introducing AppDomain concept.
Also type casting is another overhead when you try to compare of assign variables in non typed langugaes.
Let me know if you would like to know further more.
Jayant D. Kulkarni
Brainbench Certified Software Engineer in C#, ASP.NET, .NET Framework and ADO.NET
|
|
|
|
|
Vijay Joshi wrote: why actually should we care about data type definition;
Type safety is another way to say that the compiler understands what your intention is, and is able to enforce it.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
|
Hi all,
I have to use EPSON LX 300+ for my printing job. So I want to send an escape sequences to printer to be able to format the text before printing, but I cant recognize how hould I do this ??
forexample I wrote this for Form Feed(corresponds 12 for decimal) (char)27+(char)12 but nothing effected.
Is there anyone who shows me a some sample code, or give me a some hints are greatly appreciated..
thanx.
metin.
meTin.eRGoktas
|
|
|
|
|
http://support.microsoft.com/?scid=kb%3BEN-US%3B322090
I just sent a 12 (without the esc).
|
|
|
|
|
thanks, but still not clear,
forexample document says below for horizontal/vertical skip. How my code should be if m = 1,n=100
according to documentation.
Format
ASCII ESC f m n
Hex 1B 66 m n
Decimal 27 102 m n
Parameter range
0 £ n £ 127
m = 0, 1
Moves the print position depending on the value of m, as follows:
m = 0 Prints n spaces in the current pitch.
1 Performs n line feeds, in the current line spacing
Moves the horizontal print position to the left-margin position.
meTin.eRGoktas
|
|
|
|
|
stnode.InnerText.CompareTo(string);
this function works well wen the string provided and the innertext are both string of english characters but the same dsnt apply to Urdu characters wat cud be the solution for this for unicode languages
regards
bia
|
|
|
|
|
Hi all,
I want to apply new theme to my application rather than using a default windows theme...How can i do that???
nishu
|
|
|
|
|
Hi all,
How to apply perticular themes to c# application forms???
nishu
|
|
|
|
|
Please don't repost the questions.
U can find many solutions on Codeproject, just search for them.
Thanks & Regards,
Pramod
"Everyone is a genius at least once a year"
|
|
|
|
|
Yadav,
It was done by mistake....Do you have any problem in that???
Why are you worrying about the question posted 2 times...................................If you have answer share in the forum.................
nishu
|
|
|
|
|
That's Ok, that was just a suggestion and not an order
I had written "Please".
Well wht actually do u want to do?
I mean do u want the theme for the whole form or only the controls in that?
Thanks & Regards,
Pramod
"Everyone is a genius at least once a year"
|
|
|
|
|
May be i took it wrongly...
But I wanted to know that,
If my application has different forms than how can I apply different themes to them...
Thanx
nishu
|
|
|
|
|
You can't, not XP themes. You'd have to write your own skinning code. And, I concur, please don't double post.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Hi,
Do i need to reply the same thing for you??
Havent you read my message regarding the double post
nishu
|
|
|
|
|
Niiiiiiiisssssshhhhhhuuuuuuu wrote: Do i need to reply the same thing for you??
Well, no, you could learn some manners, instead. I thought perhaps by also trying to help you, you may stop and think that the nature of community involves giving as well as taking. In your case, what you can give, is to not waste space in the forums by double posting your question.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Christian Graus wrote: Well, no, you could learn some manners, instead
How rude. He has a problem about being pointed out having the same question posted. Why can't he say sorry and delete the other post?
Some people have a memory and an attention span, you should try them out one day. - Jeremy Falcon
|
|
|
|
|
hi,
Does anyone knows what is the LDAPDisplayName that allows me to know if the user is disabled or enabled.
Best regards
jamil abou khalil
|
|
|
|
|
Dear Sirs
i wrote a c# program for my self and i want install my program on the other computer. when i install this program the database file will appear obviusly and any one can delete or remove it. how i can make my database file hidden when i install it on other computers?
B.regards
Morteza
khkjhkh
|
|
|
|
|
Mortezaonline2004 wrote: how i can make my database file hidden when i install it on other computers?
Why hide the database file? If someone wants to remove it or delete it, it'll make your program not work and it would be their own fault
Some people have a memory and an attention span, you should try them out one day. - Jeremy Falcon
|
|
|
|
|
If you are using ACCESS database then u can protect it using password. If it is XML file then probably you can write encrypt and decrypt algorithm and store encrypted data in XML and later decrypt it. If somebody deletes the file then he can delete your application also. So nothing will work..
Jayant D. Kulkarni
Brainbench Certified Software Engineer in C#, ASP.NET, .NET Framework and ADO.NET
|
|
|
|
|
hi all,
is there any way to convert a xml file to pdf file ?
plz help...
thanks
|
|
|
|
|
Hi everyone,
how can I determine the length of a message in a named pipe? I am using the CreateFile API function to get the Handle to the named pipe and pass it to the FileStream constructor - I can read/write messages and even do async operations. The windows service (named pipe server) writes large XMLs (message) into the pipe. Right now I am using myFileStream.ReadByte() to read sigle bytes - pretty slow.
Is there any way to get the length of the message in a named pipe?
Thanks,
Olcay
|
|
|
|
|
I just bought a Tira IR receiver and I want to be able to use it with C#, but I havn't done much c++ coding before. Could somebody help me out with writing a c# dllimport function for this:
<br />
typedef int (__stdcall * tira_six_byte_cb) (const char * eventstring);<br />
extern "C" __stdcall int tira_set_handler ( tira_six_byte_cb cb );<br />
any help would be appreciated
Thanks
|
|
|
|