• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 418
  • Last Modified:

Change object properties from get to get ; set

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=0.0.0.0, 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=0.0.0.0, 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

0
davesnb
Asked:
davesnb
  • 2
1 Solution
 
rwskasCommented:
Is this a custom object your creating / coding?
0
 
davesnbAuthor Commented:
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.
0
 
rwskasCommented:
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.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Improved Protection from Phishing Attacks

WatchGuard DNSWatch reduces malware infections by detecting and blocking malicious DNS requests, improving your ability to protect employees from phishing attacks. Learn more about our newest service included in Total Security Suite today!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now