Click here to Skip to main content
15,881,852 members
Home / Discussions / C#
   

C#

 
AnswerRe: Data storage and Uploading file Pin
half-life23-Jul-08 19:53
half-life23-Jul-08 19:53 
GeneralRe: Data storage and Uploading file Pin
Abdul Sami X24-Jul-08 20:15
Abdul Sami X24-Jul-08 20:15 
QuestionCopy Dictionay Object To Other [modified] Pin
vaibhav.jape@gmail.com23-Jul-08 13:30
vaibhav.jape@gmail.com23-Jul-08 13:30 
AnswerRe: Copy Dictionay Object To Other Pin
N a v a n e e t h23-Jul-08 17:01
N a v a n e e t h23-Jul-08 17:01 
GeneralRe: Copy Dictionay Object To Other Pin
vaibhav.jape@gmail.com23-Jul-08 17:20
vaibhav.jape@gmail.com23-Jul-08 17:20 
AnswerRe: Copy Dictionay Object To Other [modified] Pin
Elroy Dsilva23-Jul-08 17:10
Elroy Dsilva23-Jul-08 17:10 
AnswerRe: Copy Dictionay Object To Other Pin
Elroy Dsilva23-Jul-08 17:37
Elroy Dsilva23-Jul-08 17:37 
AnswerRe: Copy Dictionay Object To Other Pin
N a v a n e e t h23-Jul-08 19:30
N a v a n e e t h23-Jul-08 19:30 
vaibhav.jape@gmail.com wrote:
dictB = dictA


This don't work. You want to copy all the ClassA objects value to ClassB object and store in dictB, right ?
class ClassA
{
    public string str = string.Empty;
    public ClassA(string str) {
        this.str = str;
    }
}

class ClassB
{
    public string str = string.Empty;
    public ClassB(string str) {
       this.str = str;
    }
}
To copy values, you can use
Dictionary<string, ClassA> dictA = new Dictionary<string, ClassA>();
dictA.Add("X", new ClassA("First"));
dictA.Add("Y", new ClassA("Second"));
dictA.Add("Z", new ClassA("Third"));

Dictionary<string, ClassB> dictB = new Dictionary<string, ClassB>(dictA.Count);
foreach (KeyValuePair<string, ClassA> pair in dictA) {
     dictB.Add(pair.Key, new ClassB(pair.Value.str));
}


All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia

How to use google | Ask smart questions

QuestionHow to access an IEnumerable item using reflection [modified] Pin
Clive D. Pottinger23-Jul-08 12:39
Clive D. Pottinger23-Jul-08 12:39 
AnswerRe: How to access an IEnumerable item using reflection Pin
Luc Pattyn23-Jul-08 13:01
sitebuilderLuc Pattyn23-Jul-08 13:01 
GeneralRe: How to access an IEnumerable item using reflection Pin
Clive D. Pottinger23-Jul-08 13:53
Clive D. Pottinger23-Jul-08 13:53 
GeneralRe: How to access an IEnumerable item using reflection [modified] Pin
Luc Pattyn23-Jul-08 14:52
sitebuilderLuc Pattyn23-Jul-08 14:52 
GeneralRe: How to access an IEnumerable item using reflection Pin
Clive D. Pottinger23-Jul-08 15:44
Clive D. Pottinger23-Jul-08 15:44 
GeneralRe: How to access an IEnumerable item using reflection Pin
Luc Pattyn23-Jul-08 15:51
sitebuilderLuc Pattyn23-Jul-08 15:51 
GeneralRe: How to access an IEnumerable item using reflection Pin
Luc Pattyn23-Jul-08 16:13
sitebuilderLuc Pattyn23-Jul-08 16:13 
GeneralRe: How to access an IEnumerable item using reflection Pin
Luc Pattyn23-Jul-08 15:16
sitebuilderLuc Pattyn23-Jul-08 15:16 
AnswerRe: How to access an IEnumerable item using reflection Pin
Clive D. Pottinger23-Jul-08 14:43
Clive D. Pottinger23-Jul-08 14:43 
GeneralWithout explicit GetEnumerator Pin
Luc Pattyn24-Jul-08 2:19
sitebuilderLuc Pattyn24-Jul-08 2:19 
Questiondropdownlist data fetch Pin
scottichrosaviakosmos23-Jul-08 8:02
scottichrosaviakosmos23-Jul-08 8:02 
GeneralRe: dropdownlist data fetch Pin
nelsonpaixao23-Jul-08 14:43
nelsonpaixao23-Jul-08 14:43 
GeneralRe: dropdownlist data fetch Pin
scottichrosaviakosmos23-Jul-08 17:23
scottichrosaviakosmos23-Jul-08 17:23 
AnswerRe: dropdownlist data fetch [modified] Pin
nelsonpaixao24-Jul-08 13:39
nelsonpaixao24-Jul-08 13:39 
QuestionProblem booking timeslots within a range of dates Pin
Twyce23-Jul-08 7:18
Twyce23-Jul-08 7:18 
AnswerRe: Problem booking timeslots within a range of dates Pin
Luc Pattyn23-Jul-08 8:01
sitebuilderLuc Pattyn23-Jul-08 8:01 
QuestionWizard Control Suggestions Pin
jchalfant23-Jul-08 7:13
jchalfant23-Jul-08 7:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.