Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace MyNamespace
- {
- public class MyClass
- {
- private int myField;
- public int MyProperty
- {
- get
- {
- return this.myField;
- }
- set
- {
- if (value < 0)
- {
- throw new ArgumentOutOfRangeException("value", "MyProperty must be non-negative");
- }
- this.myField = value;
- }
- }
- public void MyMethod(int myParameter)
- {
- if (myParameter > 0)
- {
- Console.WriteLine("MyParameter is positive");
- }
- else
- {
- Console.WriteLine("MyParameter is zero or negative");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement