StripToStringKeys









How do I use Strip To String Keys
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets


File name: Extensions.cs Copy
119     public static Hashtable StripToStringKeys(this IDictionary original)
120     {
121         Hashtable target = new Hashtable();
122         foreach (DictionaryEntry pair in original)
123         {
124             if (pair.Key is string)
125             {
126                 target[pair.Key] = pair.Value;
127             }
128         }
129
130         return target;
131     }
File name: LoadbalancingPeer.cs Copy
282         public bool OpSetCustomPropertiesOfActor(int actorNr, Hashtable actorProperties, bool broadcast, byte channelId)
283         {
284             return this.OpSetPropertiesOfActor(actorNr, actorProperties.StripToStringKeys(), broadcast, channelId);
285         }
File name: LoadbalancingPeer.cs Copy
321         public bool OpSetCustomPropertiesOfRoom(Hashtable gameProperties, bool broadcast, byte channelId)
322         {
323             return this.OpSetPropertiesOfRoom(gameProperties.StripToStringKeys(), broadcast, channelId);
324         }
File name: PhotonPlayer.cs Copy
184     public void SetCustomProperties(Hashtable propertiesToSet)
185     {
186         if (propertiesToSet == null)
187         {
188             return;
189         }
190
191         // merge (delete null-values)
192         this.customProperties.MergeStringKeys(propertiesToSet); // includes a Equals check (simplifying things)
193         this.customProperties.StripKeysWithNullValues();
194
195         // send (sync) these new values
196         Hashtable customProps = propertiesToSet.StripToStringKeys() as Hashtable;
197         if (this.actorID > 0 && !PhotonNetwork.offlineMode)
198         {
199             PhotonNetwork.networkingPeer.OpSetCustomPropertiesOfActor(this.actorID, customProps, true, 0);
200         }
201         NetworkingPeer.SendMonoMessage(PhotonNetworkingMessage.OnPhotonPlayerPropertiesChanged, this, propertiesToSet);
202     }
File name: Room.cs Copy
196     public void SetCustomProperties(Hashtable propertiesToSet)
197     {
198         if (propertiesToSet == null)
199         {
200             return;
201         }
202
203         // merge (delete null-values)
204         this.customProperties.MergeStringKeys(propertiesToSet); // includes a Equals check (simplifying things)
205         this.customProperties.StripKeysWithNullValues();
206
207
208         // send (sync) these new values
209         Hashtable customProps = propertiesToSet.StripToStringKeys() as Hashtable;
210         if (!PhotonNetwork.offlineMode)
211         {
212             PhotonNetwork.networkingPeer.OpSetCustomPropertiesOfRoom(customProps, true, 0);
213         }
214         NetworkingPeer.SendMonoMessage(PhotonNetworkingMessage.OnPhotonCustomRoomPropertiesChanged, propertiesToSet);
215     }

StripToStringKeys 122 lượt xem

Gõ tìm kiếm nhanh...