We help IT Professionals succeed at work.

Change object properties from get to get ; set

davesnb asked
Medium Priority
Last Modified: 2012-08-20
How do I change a property of an object from get only to get; set . Below is the sample code, I wish to change "clientcredentials" to be {get ; set } . Never quite picked up on this concept in powershell101.

$proxy |gm
     TypeName: ReservationInvoiceServiceClient

    Name                    MemberType Definition                                                                                                                                                   
    ----                    ---------- ----------                                                                                                                                                   
    Abort                   Method     System.Void Abort()                                                                                                                                         
    BeginClose              Method     System.IAsyncResult BeginClose(System.AsyncCallback callback, System.Object state), System.IAsyncResult BeginClose(System.TimeSpan timeout, System.AsyncCa...
    BeginOpen               Method     System.IAsyncResult BeginOpen(System.AsyncCallback callback, System.Object state), System.IAsyncResult BeginOpen(System.TimeSpan timeout, System.AsyncCall...
    Close                   Method     System.Void Close(), System.Void Close(System.TimeSpan timeout)                                                                                             
    DisplayInitializationUI Method     System.Void DisplayInitializationUI()                                                                                                                       
    Dispose                 Method     System.Void Dispose()                                                                                                                                       
    EndClose                Method     System.Void EndClose(System.IAsyncResult result)                                                                                                             
    EndOpen                 Method     System.Void EndOpen(System.IAsyncResult result)                                                                                                             
    Equals                  Method     bool Equals(System.Object obj)                                                                                                                               
    GetHashCode             Method     int GetHashCode()                                                                                                                                           
    GetReservation          Method    Company.Product.IWeb.ReservationResponse, 0ofr1eqk, Version=, Culture=neutral, PublicKeyToken=null GetReservation(Companys.Product.IWeb.Reservatio...
    GetType                 Method     type GetType()                                                                                                                                               
    Open                    Method     System.Void Open(), System.Void Open(System.TimeSpan timeout)                                                                                               
    ToString                Method     string ToString()                                                                                                                                           
    ChannelFactory          Property   System.ServiceModel.ChannelFactory`1[[IReservationInvoiceService, 0ofr1eqk, Version=, Culture=neutral, PublicKeyToken=null]] ChannelFactory {get;}   
    ClientCredentials       Property   System.ServiceModel.Description.ClientCredentials ClientCredentials {get;}                                                                                   
    Endpoint                Property   System.ServiceModel.Description.ServiceEndpoint Endpoint {get;}                                                                                             
    InnerChannel            Property   System.ServiceModel.IClientChannel InnerChannel {get;}                                                                                                       
    State                   Property   System.ServiceModel.CommunicationState State {get;}     

Open in new window

Watch Question

Is this a custom object your creating / coding?


It is a web service , but I was told i could connect via

WebServiceClient.ClientCredentials.UserName.UserName = "username";
WebServiceClient.ClientCredentials.UserName.Password = "password";

When i run proxy.open it will attempt to pass the credentials, so appears the credential property needs to be get; set.

So really two part question, with the goal of connecting to this webservice using the wcf web proxy functions i found on posh code.
If its not a object you're creating, but rather one your loading, then you cannot change the get to a get;set. Thats defined at the object level.

If you can provide some more context to the script your trying to pass these credentials to,
I am sure we can get this sorted out for you.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.