Boolean
How do I use Boolean
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
Line | Code | Ex.. |
---|---|---|
188 | this.removedFromList = (Boolean)propertiesToCache[GameProperties.Removed]; | 1 |
File name: RoomInfo.cs
Copy
176 protected internal void CacheProperties(Hashtable propertiesToCache)
177 {
178 if (propertiesToCache == null || propertiesToCache.Count == 0 || this.customPropertiesField.Equals(propertiesToCache))
179 {
180 return;
181 }
182
183 // check of this game was removed from the list. in that case, we don't
184 // need to read any further properties
185 // list updates will remove this game from the game listing
186 if (propertiesToCache.ContainsKey(GameProperties.Removed))
187 {
188 this.removedFromList = (Boolean)propertiesToCache[GameProperties.Removed];
189 if (this.removedFromList)
190 {
191 return;
192 }
193 }
194
195 // fetch the "well known" properties of the room, if available
196 if (propertiesToCache.ContainsKey(GameProperties.MaxPlayers))
197 {
198 this.maxPlayersField = (byte)propertiesToCache[GameProperties.MaxPlayers];
199 }
200
201 if (propertiesToCache.ContainsKey(GameProperties.IsOpen))
202 {
203 this.openField = (bool)propertiesToCache[GameProperties.IsOpen];
204 }
205
206 if (propertiesToCache.ContainsKey(GameProperties.IsVisible))
207 {
208 this.visibleField = (bool)propertiesToCache[GameProperties.IsVisible];
209 }
210
211 if (propertiesToCache.ContainsKey(GameProperties.PlayerCount))
212 {
213 this.playerCount = (int)((byte)propertiesToCache[GameProperties.PlayerCount]);
214 }
215
216 if (propertiesToCache.ContainsKey(GameProperties.CleanupCacheOnLeave))
217 {
218 this.autoCleanUpField = (bool)propertiesToCache[GameProperties.CleanupCacheOnLeave];
219 }
220
221 //if (propertiesToCache.ContainsKey(GameProperties.PropsListedInLobby))
222 //{
223 // // could be cached but isn't useful
224 //}
225
226 // merge the custom properties (from your application) to the cache (only string-typed keys will be kept)
227 this.customPropertiesField.MergeStringKeys(propertiesToCache);
228 }
Download file with original file name:Boolean
Boolean 99 lượt xem
Gõ tìm kiếm nhanh...