Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.ServiceModel;
- namespace CHAT
- {
- public class ServerUser
- {
- public int ID { get; set; }
- public string Name { get; set; }
- public OperationContext operationContext { get; set; }
- }
- }
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Runtime.Serialization;
- using System.ServiceModel;
- using System.Text;
- namespace CHAT
- {
- [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
- public class Service1 : IService1
- {
- List<ServerUser> users = new List<ServerUser>();
- int nextId = 1;
- public int Connect(string name)
- {
- ServerUser user = new ServerUser();
- {
- ID = nextId;
- Name = name;
- operationContext = OperationContext.Current;
- };
- ++nextId;
- users.Add(user);
- return user.ID;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement