473,396 Members | 1,966 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Default value

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

Oct 12 '06 #1
1 1311
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
-----------------------------------------

Oct 13 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

29
by: John Wood | last post by:
Even though CSC does its best to detect use of unassigned variables, it often misses it... for example if you just declare a double in a class without assigning a default value, it has a default...
74
by: Zytan | last post by:
I have a struct constructor to initialize all of my private (or public readonly) fields. There still exists the default constructor that sets them all to zero. Is there a way to remove the...
23
by: Jess | last post by:
Hello, I understand the default-initialization happens if we don't initialize an object explicitly. I think for an object of a class type, the value is determined by the constructor, and for...
4
by: Jess | last post by:
Hello, I tried several books to find out the details of object initialization. Unfortunately, I'm still confused by two specific concepts, namely default-initialization and...
10
by: Brad Baker | last post by:
I have an asp.net/csharp application that requires a particular variable to work properly. This variable is usually passed via a query string in the URL when the application is first run but under...
4
by: Macneed | last post by:
i am a newbie, i remember i read a book talking about when u declare a array variable using float ABC = new float; the whole array element in ABC ( ABC to ABC ) will automatic initialize to 0...
4
by: Dave Burns | last post by:
Hello, I am trying to specify a logical default value for a in a WCF Web Service using basicHttpBinding. I realize that the language defaults are: int - 0 string - null bool - false
7
by: =?Utf-8?B?Y291Z2FyaXN0aWM=?= | last post by:
I am trying to convert an C# application to VB and have one issue which is converting the generic value to the default. C# uses return default(T) as the return value how would I translate this in...
43
by: kenneth | last post by:
Dear all, I have encountered this weird problem. I have a class definition with an __init__ argument 'd' which defaults to {}. This argument is put in the 'self.d' attribute at initialization...
9
by: lawpoop | last post by:
I'm trying to write some simple code, but I might be simplifying it too much. I have a function that either returns a string that I want, or FALSE. In the code that I'm working on, I would like...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
Oralloy
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,...
0
jinu1996
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...
0
agi2029
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,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.