0

Using Settings in C# we can assign a Set of Settings like ,Name ,Location ,Size etc. using Visual Studio and chose at which Scope it should be (Application/User).

My Question is ,can i use a Set of Settings separately for each user . Like i would Save User's like User1,User2,User3 where every user have same Attributes like Name ,Surname , Department .

So using Settings is it possible to save Name ,Surname and Department for User1 than the same thing for User2 .

Or is it better to create an Object User with those Fields/Properties and Serialize/Deserialize into XML .

Note : Attributes in this question are just Examples .

Rosmarine Popcorn
  • 10,761
  • 11
  • 59
  • 89

2 Answers2

0
  • Option 1 : As you've mentioned, you could serialize your objects like here (http://www.codeproject.com/KB/XML/xml_serializationasp.aspx)

    Note : That article is old, you probably don't want to use the ArrayList.

  • Option 2 (Recommended): You could use your own custom type with Application Settings : Custom type application settings in ASP.NET

    Referring to the linked question, you could do this:

    public class MyUser
    {
       public string Name { get; set; }
       public string Surname { get; set; }
       public int Age { get; set; }
    }
    public class UserCollection : Collection<MyUser>
    {
    }
    
Community
  • 1
  • 1
gideon
  • 19,329
  • 11
  • 72
  • 113
0

I might be wrong but it looks like you're trying to use Application Settings as data storage. You should consider using database for storing data (MSSQL Server CE for example)

Rytis I
  • 1,105
  • 8
  • 19
  • No that's wrong ,im not trying to use Application Settings as data Storage in meanwhile ,im just trying to use Application Settings with some Information like it is designed to but each one for Specific user ,try to read the Question again !So using MSSQL for User Configuration is bad idea . – Rosmarine Popcorn Oct 17 '11 at 08:35