Hi,
Is it possible on VB.NET to create anonymous arrays, e.g. passing
arrays directly as a method-parameter instead of reference it from a
variable.
In C#, I can do this:
string s = "Blah blah, Aloha!";
string[] sArr = s.Split(new String[]{","});
In VB, do I really have to do it this way?
Dim s As String = "Blah blah, Aloha!"
Dim seperator() As Char = {CType(",", Char)}
Dim sArr() As String = s.Split(seperator) 6 7475
Hi,
Not really sure what u r asking.. but.. in VB y not code as follows?
Dim s As String = "Blah blah, Aloha!"
Dim sArr() As String = s.Split(CChar(","))
not sure how this is all that different from the C# version? appart from the
syntax obv.
Rigga.
"Anders Thomsen" <ju**@mexp.dk> wrote in message
news:5d**************************@posting.google.c om... Hi,
Is it possible on VB.NET to create anonymous arrays, e.g. passing arrays directly as a method-parameter instead of reference it from a variable.
In C#, I can do this: string s = "Blah blah, Aloha!"; string[] sArr = s.Split(new String[]{","});
In VB, do I really have to do it this way? Dim s As String = "Blah blah, Aloha!" Dim seperator() As Char = {CType(",", Char)} Dim sArr() As String = s.Split(seperator)
Hi Anders, In C#, I can do this: string s = "Blah blah, Aloha!"; string[] sArr = s.Split(new String[]{","});
In VB, do I really have to do it this way? Dim s As String = "Blah blah, Aloha!" Dim seperator() As Char = {CType(",", Char)} Dim sArr() As String = s.Split(seperator)
Most people do it like this,
Dim s As String = "Blah blah, Aloha!"
Dim sArr() As String = s.Split(",")
Maybe this is better, but I did never saw it done in this newsgroup and I
did not look to the intermidiate code for this.
Dim s As String = "Blah blah, Aloha!"
Dim sArr() As String = s.Split(","c)
I hope this helps?
Cor
"Anders Thomsen" <ju**@mexp.dk> schrieb Is it possible on VB.NET to create anonymous arrays, e.g. passing arrays directly as a method-parameter instead of reference it from a variable.
In C#, I can do this: string s = "Blah blah, Aloha!"; string[] sArr = s.Split(new String[]{","});
In VB, do I really have to do it this way? Dim s As String = "Blah blah, Aloha!" Dim seperator() As Char = {CType(",", Char)} Dim sArr() As String = s.Split(seperator)
Dim sArr() As String = s.Split(new char(){","c})
--
Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
Dim s As String = "Blah blah, Aloha!"
Dim sArr() As String = s.Split(New Char() {","c})
--
HTH,
-- Tom Spink, Über Geek
Woe be the day VBC.EXE says, "OrElse what?"
Please respond to the newsgroup,
so all can benefit
"Anders Thomsen" <ju**@mexp.dk> wrote in message
news:5d**************************@posting.google.c om... Hi,
Is it possible on VB.NET to create anonymous arrays, e.g. passing arrays directly as a method-parameter instead of reference it from a variable.
In C#, I can do this: string s = "Blah blah, Aloha!"; string[] sArr = s.Split(new String[]{","});
In VB, do I really have to do it this way? Dim s As String = "Blah blah, Aloha!" Dim seperator() As Char = {CType(",", Char)} Dim sArr() As String = s.Split(seperator)
* ju**@mexp.dk (Anders Thomsen) scripsit: Is it possible on VB.NET to create anonymous arrays, e.g. passing arrays directly as a method-parameter instead of reference it from a variable.
Yes:
\\\
....(..., New Char() {","c, ":"c, ...}, ...)
///
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Anders,
In addition to the others comments (on how to actually create an "anonymous"
array) :
In C# you can do this: string s = "Blah blah, Aloha!"; string[] sArr = s.Split(',');
In VB, you can also do this: Dim s As String = "Blah blah, Aloha!" Dim sArr() As String = s.Split(","c)
Seeing as String.Split uses a ParamArray parameter, the compiler will
dynamically create an "anonymous" array for you, there is no real need to
explicitly create one (although one is supported if you already have one, or
you need to use String.ToCharArray).
Hope this helps
Jay
"Anders Thomsen" <ju**@mexp.dk> wrote in message
news:5d**************************@posting.google.c om... Hi,
Is it possible on VB.NET to create anonymous arrays, e.g. passing arrays directly as a method-parameter instead of reference it from a variable.
In C#, I can do this: string s = "Blah blah, Aloha!"; string[] sArr = s.Split(new String[]{","});
In VB, do I really have to do it this way? Dim s As String = "Blah blah, Aloha!" Dim seperator() As Char = {CType(",", Char)} Dim sArr() As String = s.Split(seperator) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Nick Coghlan |
last post by:
GvR has commented that he want to get rid of the lambda keyword for Python 3.0.
Getting rid of lambda seems like a worthy goal, but I'd prefer to see it dropped
in favour of a different syntax,...
|
by: ip4ram |
last post by:
I used to work with C and have a set of libraries which allocate
multi-dimensional arrays(2 and 3) with single malloc call.
data_type **myarray
=...
|
by: Stijn van Dongen |
last post by:
A question about void*. I have a hash library where the hash create
function accepts functions
unsigned (*hash)(const void *a)
int (*cmp) (const void *a, const void *b)
The insert function...
|
by: Paul E Collins |
last post by:
This does what you'd expect ...
string foo = { "bar", "baz", "quux" };
.... so why is this a syntax error?
private string foo()
{
return { "bar", "baz", "quux" };
}
|
by: yeti349 |
last post by:
Hi, I'm using the following code to retrieve data from an xml file and
populate a javascript array. The data is then displayed in html table
form. I would like to then be able to sort by each...
|
by: Leszek |
last post by:
Hi.
Is it possible in javascript to operate on an array without knowing how mamy
elements it has?
What i want to do is sending an array to a script, and this script should
add all values from...
|
by: John Mark Howell |
last post by:
I had a customer call about some C# code they had put together that was
handling some large arrays. The performance was rather poor. The C# code
runs in about 22 seconds and the equivalent...
|
by: jacob navia |
last post by:
Gnu C features some interesting extensions, among others
compound statements that return a value. For instance:
({ int y = foo(); int z;
if (y>0) z = y; else z=-y;
z;
})
A block enclosed by...
|
by: David Golightly |
last post by:
Quick question for the gurus out there: in ECMAScript, one can create
a new Array object with a length like so:
var animals = new Array(128);
This creates a new Array object with a "length"...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |