~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to external/maccore/src/AddressBook/ABMultiValue.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
// Authors: Mono Team
5
5
//     
6
6
// Copyright (C) 2009 Novell, Inc
 
7
// Copyright 2011, 2012 Xamarin Inc.
7
8
//
8
9
// Permission is hereby granted, free of charge, to any person obtaining
9
10
// a copy of this software and associated documentation files (the
121
122
 
122
123
                static Exception CreateNotSupportedException ()
123
124
                {
124
 
                        return new NotSupportedException ("Instance is read-only.  " + 
125
 
                                        "To update properties, use an ABMutableMultiValue<T>.  " +
 
125
                        return new NotSupportedException ("ABMultiValue record is read-only. " + 
 
126
                                        "To update properties, use an ABMutableMultiValue<T>. " +
126
127
                                        "See ABMultiValue<T>.ToMutableMultiValue().");
127
128
                }
128
129
 
132
133
                                return self.toManaged (ABMultiValue.CopyValueAtIndex (self.Handle, index));
133
134
                        }
134
135
                        set {
135
 
                                if (!IsReadOnly)
 
136
                                if (IsReadOnly)
136
137
                                        throw CreateNotSupportedException ();
137
 
                                ABMultiValue.ReplaceValueAtIndex (self.Handle, ToIntPtr (value), index);
 
138
                                AssertValid ();
 
139
                                if (!ABMultiValue.ReplaceValueAtIndex (self.Handle, ToIntPtr (value), index))
 
140
                                        throw new ArgumentException ("Value cannot be set");
138
141
                        }
139
142
                }
140
143
 
144
147
                                return (NSString) Runtime.GetNSObject (ABMultiValue.CopyLabelAtIndex (self.Handle, index));
145
148
                        }
146
149
                        set {
147
 
                                if (!IsReadOnly)
 
150
                                if (IsReadOnly)
148
151
                                        throw CreateNotSupportedException ();
 
152
                                AssertValid ();
149
153
                                ABMultiValue.ReplaceLabelAtIndex (self.Handle, ABMultiValue.ToIntPtr (value), index);
150
154
                        }
151
155
                }