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(seperat or) 6 7510
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.goo gle.com... 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(seperat or)
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(seperat or)
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(seperat or)
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.goo gle.com... 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(seperat or)
* 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.ToCharAr ray).
Hope this helps
Jay
"Anders Thomsen" <ju**@mexp.dk > wrote in message
news:5d******** *************** ***@posting.goo gle.com... 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(seperat or) 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, rather than completely losing the ability to
have anonymous functions.
Anyway, I'm looking for feedback on a def-based syntax that came up in a recent
c.l.p discussion:...
|
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
= (data_type**)malloc(widht*height*sizeof(data_type)+ height*
sizeof(data_type*));
//allocate individual addresses for row pointers.
Now that I am moving to C++,am looking for something by which I can
|
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 accepts a void* key argument, and uses the
functions above to store this argument. It returns something (linked to
the key) that the caller can store a value in. The actual key argument
is always of the same pointer type (as seen in the caller,...
|
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 column. Once the
array elements are split, what is the best way to sort them? Thank you.
//populate data object with data from xml file.
//Data is a comma delimited list of values
var jsData = new Array();
jsData = {lib: "#field...
| |
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 that array
Could you show me a little example how to do this?
Thanks.
|
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 C++.Net code runs in 0.3
seconds. Can someone help me understand why the C# code performance is so
poor? I rewote the C# code to use a single dimenional array and the time
went down to about 3 seconds, but that's still no explaination as to why the...
|
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 braces can appear within parentheses
to form a block that "returns" a value. This is handy
in some macros, or in other applications.
|
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" property set to 128.
My question: Does this in any sense "preallocate" memory for any of
these 128 slots? I've seen the word "preallocate" bandied about, but
my experience with UAs tells me this term is being misused; all 128 of
those "slots"...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |