|
|
I want to increment the size of array at run time and also want to preserve the data already existing in the array
Help me please
|
|
|
|
|
There is no way of changing the size of an array. You have to create a new array of the desired size and copy the contents of the old array to the new.
Perhaps you want to use a list or dictionary instead of an array.
---
b { font-weight: normal; }
|
|
|
|
|
We use redim in vb.net is not there any redim like function in C#.
Thanks
|
|
|
|
|
No, there isn't any ReDim in C# or in the .NET framework.
The ReDim command in VB.NET just does what I described. It probably exists mostly for historical reasons, and I suggest that you don't use it at all. Leave the ancient commands behind and use what's in the framework.
---
b { font-weight: normal; }
|
|
|
|
|
|
There is a Collection Class called ArrayList. There are three methods: (Add, Insert, Remove). You can find this code example in Visual C# .NET Step by Step.
Quick Example:
ArrayList numbers = new ArrayList();
//fill the arrayList
foreach (int number in new int[12}{10,9,8,7,7,6,5,4,3,2,1})
{
numbers.Add(number);
}
//Remove first element whose value is 7 (the fourth (4th) index 3)
numbers.Remove(7);
//Now remove the element that's now the 7th element. index: 6 (10)
numbers.RemoveAt(6);
Hope this helps. . .
Tom Johnson
A+, MCP MCSD .NET SQL
|
|
|
|
|
Hi.
I have VS 2003 on my computer and I am wondering if I can install VS 2005 also on my computer without uninstalling 2003. Can I have both VS 2003 and VS 2005 on my computer at the same time?
Thanks,
F
F
|
|
|
|
|
|
Sure you can (If your PC requrments for installing both of vs.net 2003 and vs.net 2005).
|
|
|
|
|
having following problem
i use a xmltextreader to read a xml document. After i construct it, i create a xmlvalidating reader based on this xmltextreader.
Then i create a xpathdocument on this object
XmlTextReader reader = new XmlTextReader(XXX);
XmlValidatingReader validatingReader = new XmlValidatingReader(reader);
validatingReader.Schemas.Add(XmlSchemaCache.GetInstance().GetSchema("MYSCHEMA"));
validatingReader.ValidationType = ValidationType.Schema;
XmlReader readerToUse = validatingreader
XPathDocument document = new XPathDocument(readerToUse );
document.createnavigator() --> here my code crashes.
why? in the incoming (XXX) xml file, the default namespace is missing. Now i can't add the namespace to the file manually. So my question is now, how can i add the namespace is added to the reader, before i do document.createnavigator, without using DOM.
i hope someone can help me out
|
|
|
|
|
Com'on people, no one can help me out here?
|
|
|
|
|
I'm trying to figure out how i can access the source of a website or read the text right off the page. in more detail, i want to be able to run the program and have it automatically open up, lets say cnn.com (example), and do searches for html tags or words to load all the "latest news" headlines into a database for later access.
-Scott
|
|
|
|
|
Do you want to use something like a RSS feed?
|
|
|
|
|
You can use an HttpWebRequest object to request a web page.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks, that pointed me in the right direction.
|
|
|
|
|
I have looked all over the place for source code to PING another host written in C#.
I want to read hostnames from a config file and check to see if they are alive.
Can anyone help me?
-- modified at 8:12 Monday 10th April, 2006
|
|
|
|
|
|
Hi, quick question.
Anyone know how to use quotes in c#.
In vb.net, I can write:
Console.Writeline ("This is a " & chr(34) & "quote" & chr(34));
which would output:
This is a "quote"
So how can I do it in C#?
PS: I need a quote ("), not a hypen thingy (')
|
|
|
|
|
You can insert meta-symbols directly into text after "\" symbol.
Your sample:
Console.WriteLine("This is a \"quote\"");
-- modified at 7:03 Monday 17th April, 2006
|
|
|
|
|
GAAH!
Always something simple.
Thanks so much.
Andy
|
|
|
|
|
Hi Andy
Another possibility that I like is putting a "@" in front of the string.
THen you can show the "'s using double ""'s
For example:
string quote = @"Andy said ""hi!""";
this also lets you write backslashes without needing the ekstra backslash.
For example:
string path1 = "C:\\data\\text.dat";
string path2 = @"C:\data\text.dat";
now you have choices
- Jakob
Three kinds of people in the world:
- Those who can count..
- Those who can't!
|
|
|
|
|
another choice is this:
char quote = '"';
string str = "This line have " + qoute + " quote. " + quote;
result : This line have " quote. "
|
|
|
|
|
That code might prove quite inefficient, though. You risk that the compiler will box the char values, and the actual code produced will be:
char quote = '"';<br />
object[] tempArray = new object[] { (object)"This line have ", (object)quote, (object)" quote. ", (object)quote };<br />
string str = string.Concat(tempArray);
---
b { font-weight: normal; }
|
|
|
|
|
I’m in need of a good way to save load a generic List<> to a file, XML, txt or whatever. How should you do that in an easy way?
All tips are welcomed!!
_____________________________
...and justice for all
APe
|
|
|
|