Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Having an optional parameter as an object
Message
From
17/04/2006 21:00:31
 
 
To
All
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Having an optional parameter as an object
Miscellaneous
Thread ID:
01114198
Message ID:
01114198
Views:
56
Is there way to have an optional parameter which has a default of a class?

I have this declared function and I would like toApplication to be optional but would default to the Framework.App class.
    Public Shared Function Encrypt(ByVal tcString As String, ByVal tcKey As String, _
     Optional ByVal toApplication As Object = "") As Boolean
If I try the following, it gives an error:
    Public Shared Function Encrypt(ByVal tcString As String, ByVal tcKey As String, _
     Optional ByVal toApplication As Framework.App = New Framework.App) As Boolean
The error is "Constant expression is required".
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Next
Reply
Map
View

Click here to load this message in the networking platform