|
How can a Class and datatype be the same?
|
|
|
|
|
All classes are types.
string is a synonym for System.String nothing more, nothing less.
|
|
|
|
|
String is class.
string is a keyword (which is under the hood is translated to .NET class System.String )
Sincerely,
Elina
Life is great!!!
Enjoy every moment of it!
|
|
|
|
|
No difference!
string is a keyword,but String not.
string just like a shortcut for String.
|
|
|
|
|
The keyword string is an alias for System.String .
I only know of two differences between using an alias keyword and the specific class name:
:: You have to have using System; to use String , otherwise you have to specify the full name System.String .
:: For some special uses of data types only the keyword works. You can for example specify that an enum should use int as internal storage type, but you can't specify System.Int32 instead.
---
single minded; short sighted; long gone;
|
|
|
|
|
thanks alot for the clarification.
|
|
|
|
|
String is .NET CTS type where as
string is built in C# datatype which virtually means String
just like Int32 struct and int,
Bottom line both are the same
|
|
|
|
|
Hi
I'd like to know how I can open a file on the harddisk via code.
I mean opening the file in a new instance of its default associated program in windows (for example an .xls file in Excel,
not opening it via code to read from it.
thanks in advance
greetings pdluke
|
|
|
|
|
Process.Start
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
After updating a row in the datagridview, the grid is re-populated. How is it possible to make the current cell the one that was just updated. Please note that if there are many records in the grid, and say record no 380 was updated, then the grid should move the pointer (current cell) to that row.
Thanks
|
|
|
|
|
Hello, I have in my interface a button, "startButton" and a richtextbox "TextOutput", when I clik the startButton I want view in my richtextbox the content of a file "contload.txt" (which is in "c://") ...can you help me please
lavy
|
|
|
|
|
Hi,
you can do this like that
<br />
TextOutput.Text = System.IO.File.OpenText("C:\\contload.txt").ReadToEnd();<br />
hope this helps you
greetings pdluke
|
|
|
|
|
|
hi..
i want to serialize a Hashtable to a XML file..
how to do this..
currently i m using List<> to store objects, and serializing the List<> and its working fine..
but how to serialize a Hashtable.. plz help me..
regards,
nas
|
|
|
|
|
Hi
as far as I know it's not possible to serialize a Hashtable.
I had the same problems some time ago.
You could use the Dictionary<> which is in .NET 2.0, I think.
It has the same functionality as the Hashtable.
greetings
pdluke
|
|
|
|
|
try this:
Hashtable.GetObjectData Method
|
|
|
|
|
i have tried it but it is not possible using hashtable.
till i send you code which i have tried.
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Serialization;
using System.Xml.Serialization;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using System.Collections;
namespace HAshxml
{
[Serializable]
public class test
{
public int height;
public int length;
public test()
{
Console.WriteLine("Inside test parameter less constructor");
}
public test(int x,int y)
{
height = x;
length = y;
Console.WriteLine("Inside test constructor");
}
public void GetObjectData(SerializationInfo info,StreamingContext context)
{
Console.WriteLine("Inside Get object data");
}
}
public class Program
{
static void Main(string[] args)
{
test t = new test(10,20);
Hashtable ht = new Hashtable();
ht.Add("h", t);
Stream str = File.OpenWrite("D:\\abc.xml");
//BinaryFormatter formatter = new BinaryFormatter();
XmlSerializer ser = new XmlSerializer(typeof(test));
ser.Serialize(str, ht);
str.Close();
//formatter.Serialize(str, ht);
//str.Close();
//XmlTextWriter xl=new XmlTextWriter (
Console.ReadLine();
}
}
}
|
|
|
|
|
I need to change a combo box so that when the user uses autocomplete and the item is not found, the wrong item is not selected when he presses tab.
Any ideas ?
Johan Lombaard
Only two things are infinite, the universe and human stupidity, and I'm not sure about the former - Albert Einstein
|
|
|
|
|
Try checking the current value in the ComboBox with the FindStringExact() method in the Lost focus event of the Combo.
|
|
|
|
|
Hi,
I am writing a program to set up a serial port communication.
I'm doing this with SerialPort sp = new SerialPort (); and then SP.Write();
But I can only write a string format to the port. But I want to write a byte to the port. does anyone knows if this is posible and how to do this?
thanks.
|
|
|
|
|
-=gix=- wrote: does anyone knows if this is posible
Yes
-=gix=- wrote: and how to do this?
This's long to be posted here, try searching articles instead.
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Method write is overloaded.
Write(string text);
Write(byte[] buffer, int offset, int count);
Write(char[] buffer, int offset, int count);
|
|
|
|
|
I made a byte[] array in stead of a normal byte and is seems like its working!
|
|
|
|
|
In the ITypeDescriptorContext object passed to the EditValue method of UITypeEditor (i.e. the first parameter - nominally referred to as "context") there's a method member called GetService.
This is NOT to be confused with the GetService method available from the second parameter which is of Type IServiceProvider, it's parameter name being nominally "provider".
My question is twofold a) where is the ServiceCollection that presumably lies behind this method and b) how do I put things in it - Component & IComponent don't seem to provide a ServiceCollection, and if I endow my component with IServiceCollection it doesn't seem to connect with the ITypeDescriptorContext.GetService method, which never seems to be anything but null.
NB : As far as I can tell the only thing one can get from the provider.GetService is an IWindowsFormsEditorService object.
I'm working around this by putting an extra object into the attribute collection that provides yet another GetService that IS backed up by a ServiceCollection, the class also exposes the AddService and RemoveService methods.
|
|
|
|
|
Hi all,
i need to select a node in a treeview after selecting from a combobox
i.e. the treeview displays the same information as the combobox and i need to check the corresponding node selected from the combo into the treeview
thanx alot
|
|
|
|