Stylecop rule SA1623 and read-only properties in webservices(hockblogs.net)

submitted by hockmanhockman(505) 3 years, 6 months ago

Hi there, I'm currently refactoring some code (see my previous post). But during the refactoring something weird/funny/not logical Foot in mouth happened which should have been implemented better, at least that's what I think! Wink According to the following documentation rule: SA1623: Validates that a property's summary description text begins with the correct syntax, depending upon whether the property exposes get or set accessors. which verifies the content and formatting of code documentation, my comment above the property was not correctly written. I had to write my code comment with 'Gets or sets'. But that automatically implies that when someone reads the code documentation, they can set that property. All true, except in this stuation: If the class definition of the object contains a read-only property, the read-only property is not available when you build a proxy assembly for the Web service, cause read-only properties cannot be exposed by XML Web Services. That's why you have to implement a setter for it. To work around this problem, add a SET procedure for the property. You can either leave the procedure empty, so that that the procedure has no effect, or raise a custom exception to inform clients that the property is read-only.

add a comment |category: |Views: 23

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

No comments so far

information Login or create an account to comment on this story