Re: [MSH] how to list constuctor overloads

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



MSH >[System.Net.Mail.Attachment].GetConstructors() | foreach-object {
$_.ToString() }
Void .ctor(System.String)
Void .ctor(System.String, System.String)
Void .ctor(System.String, System.Net.Mime.ContentType)
Void .ctor(System.IO.Stream, System.String)
Void .ctor(System.IO.Stream, System.String, System.String)
Void .ctor(System.IO.Stream, System.Net.Mime.ContentType)

--
Jeff Jones [MSFT]
Microsoft Command Shell Development
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no rights.


"/\/\o\/\/" <no@xxxxxxxx> wrote in message
news:emgS8rk6FHA.1276@xxxxxxxxxxxxxxxxxxxxxxx
> how to get the constructors of a .net Object in MSH
>
> as I did a blogentry about sending mail in MSH, i came to this little
> problem as I got a Q of a reader onhowto send an attachement, :
> (I did it already but not without looking in the SDK for the constructor
> overloads)
>
> the golden trick of JS to find the Add Method (Watch the Comma !)
>
> MSH>,$msg.get_Attachments() | gm
>
>
> TypeName: System.Net.Mail.AttachmentCollection
> Name MemberType Definition
> ---- ---------- ----------
> Add Method System.Void Add(Attachment item)
> ......
>
> I did know that I needed an attachement object first (fits nice in the
> topic using .net objects as parameters b.t.w. ;-)
>
> but now :
>
> MSH>$att = new-object System.Net.Mail.Attachment
> new-object : Constructor not found. Cannot find an appropriate constructor
> for type System.Net.Mail.Attachment.
> At line:1 char:18
> + $att = new-object <<<< System.Net.Mail.Attachment
>
> how can I get the valid constructors ?
>
> I tricked it a bit with this :
>
> MSH>[System.Net.Mail.Attachment] | gm -static | fl
>
> TypeName : System.Net.Mail.Attachment
> Name : CreateAttachmentFromString
> MemberType : Method
> Definition : static System.Net.Mail.Attachment
> CreateAttachmentFromString(String content, String name), static
> System.Net.Mail.Attachment C
> reateAttachmentFromString(String content, String name,
> Encoding contentEncoding, String mediaType), static System.Net.Mail.Att
> achment CreateAttachmentFromString(String content,
> ContentType contentType)
>
> But its not the same as this one is missing :
>
> Attachment (String) Initializes a new instance of the Attachment class
> with the specified content string.
>
> so the question is can I get the constructor overloads from MSH ?
>
> gr /\/\o\/\/
>
> the mailing sample can be found here :
> http://mow001.blogspot.com/2005/11/sending-mail-from-msh.html


.



Relevant Pages

  • [MSH] how to list constuctor overloads
    ... I did know that I needed an attachement object first (fits nice in the ... new-object: Constructor not found. ... static System.Net.Mail.Attachment CreateAttachmentFromString(String content, String name), static System.Net.Mail.Attachment C ... achment CreateAttachmentFromString(String content, ContentType contentType) ...
    (microsoft.public.windows.server.scripting)
  • Re: How to init array of strings member by a constructor?
    ... If I don't initialize s in a constructor but then in the code write: ... void main{ ... I hope it is clear that s is an array of 3 strings and not a string of 3 chars. ...
    (microsoft.public.vc.language)
  • Re: Problem with inheritance
    ... pointer to a parent QObject and usually a char* for the name. ... > void setKeyword; ... > void setKeyword(string key, string value); ... except that it doesn't require a copy constructor. ...
    (comp.lang.cpp)
  • Re: a method to make js have the ability to inherit
    ... but without the implied type-conversion of the string ... that uses the name of a specific constructor. ... programmer has no idea at all what types of object they are ... no reason for ever doing so. ...
    (comp.lang.javascript)
  • Re: Newbie question: Writing your own class
    ... is made by a class's Create constructor method which allocates memory ... FDefinition: string; ... every other descendant of TObject ... Result:= FDefinition; ...
    (comp.lang.pascal.delphi.misc)