Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
Say I have
 
Public Function DoSomething(dim i as integer)
 
Is there some kind of syntax where I can declare the parameter at call time.
 
eg
 
Public Sub SomeSub
...
DoSomething(const SomeInteger = 5)
....
End Sub
 
or
 
Public Sub SomeSub
...
DoSomething(SomeInteger as integer= 5)
...
End Sub
Posted 10-Oct-12 15:42pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Such thing does exist, and you should know it if you are using this language:
http://msdn.microsoft.com/en-us/library/f25e2b6b%28v=vs.110%29.aspx[^].
 
Honestly, you could much better use your time if you simply read a language manual before trying to write a program and just used a reference (MSDN, apparently, provides all that), instead of asking such questions.
 
Also, you don't understand it right. Just think about it: those default values are known during compilation; there is no such thing as "defining constants at call time", otherwise you could not call them "constant". This is not the case even in your own example — they are normal constants. Apparently, constant expression are also allowed (because there are no reason not to have them: the compiler can always evaluate constant expressions).
 
—SA
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 420
1 CHill60 410
2 Sergey Alexandrovich Kryukov 384
3 PIEBALDconsult 235
4 BillWoodruff 190


Advertise | Privacy | Mobile
Web01 | 2.8.141015.1 | Last Updated 10 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100