Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Default value

Reply
Thread Tools

Default value

 
 
shapper
Guest
Posts: n/a
 
      10-12-2006
Hello,

I am creating a class where I have various properties.
I was able to set default values for most properties which have common
types.

However, I am 3 properties which I don't know how to create the default
value:

1. Mail.AttachmentCollection
I want to make it empty. But I am not sure I can do this.

Private _AttachmentCollection As Mail.AttachmentCollection
<DefaultValue("")> _
Public Property AttachmentCollection() As Mail.AttachmentCollection
...

2. Mail.MailAddressCollection
I want to create the default collection with only one MailAddress.
The one which is available in my Web.Config file under:
<system.net>
<mailSettings>
<smtp
deliveryMethod = "network"
from = "atelier@jaquelineroxoatelier">
...

Private _ToCollection As Mail.MailAddressCollection
<DefaultValue("")> _
Public Property ToCollection() As Mail.MailAddressCollection
...

3. Mail.MailAddressCollection
I want this email colection to be empty. Similar to one. It is just
a different collection type.

Private _BccCollection As Mail.MailAddressCollection
<DefaultValue("")> _
Public Property BccCollection() As Mail.MailAddressCollection

4. Mail.MailAddress
I want to create this MailAddress with the datain my Web.Config.
Similar to 2. It is just a MailAddress instead of a Collection.

' From
Private _From As Mail.MailAddress
Public Property From() As Mail.MailAddress
...

Could someone help me out with this?

Thanks,
Miguel

 
Reply With Quote
 
 
 
 
Gaurav Vaish \(www.EdujiniOnline.com\)
Guest
Posts: n/a
 
      10-13-2006
> 1. Mail.AttachmentCollection
> I want to make it empty. But I am not sure I can do this.


Mail.AttachmentCollection.Clear()

> 2. Mail.MailAddressCollection
> I want to create the default collection with only one MailAddress.


Ask SmtpSection to give the appropriate details.
Clear the collection and then add one entry.

> 3. Mail.MailAddressCollection
> I want this email colection to be empty. Similar to one. It is just
> a different collection type.


Collections are always 'Clear'-able.

> 4. Mail.MailAddress


Again, talk to SmtpSection


SmtpSection is in namespace System.Net.Configuration in System.dll

An example:

SmtpSection smtpSettings = (SmtpSection)
ConfigurationManager.GetSection("system.net/mailSettings/smtp",
typeof(SmtpSection));

string from = smtpSettings.From;


--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujinionline.com
http://eduzine.edujinionline.com
-----------------------------------------



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What value should be passed to make a function use the default argument value? LaundroMat Python 50 10-14-2006 05:11 AM
Default Mozilla isn't default! Help! M. FERRANTE Firefox 1 07-27-2005 09:07 AM
Using default a empty dictionary as a default value C Gillespie Python 3 03-22-2005 12:22 PM
Easy way to output a default value if <xsl:value-of/> selection comes back empty? Michael Ahlers XML 1 07-12-2004 05:17 PM
automatic default route propagation into RIP: default metric Ben Low Cisco 2 12-28-2003 03:57 AM



Advertisments