andreunmellow
New Member
I declared properties in the "FileData.cs" files. I want to assign the values for each property from another class "PdfMergerViewModel.cs".FileData.cs\[code\] public class FileData { private BatchData _batch; public FileData(BatchData batch) { this._batch = batch; } public string FileName { get; set; } public string VersionNormalizedFileName { get; set; } public string OrderNumber { get; set; } public DateTime OrderDate { get; set; } public string Metadata { get; private set; } public bool IsDeleted { get; set; } public string FilePath { get; set; } public string Centerpoint { get; set; } public string BatchID { get; set; } public string RegionalPrefix { get; set; } public string City { get; set; } public string FunctionLocation { get; set; } public string KeyMap { get; set; } public string State { get; set; } public string StreetNumber { get; set; } public string StreetName { get; set; } public string UnitNumber { get; set; } public string SendToGIS { get; set; } public string PipeBeforeFilename { get; set; } public IList<FileData> VersionFiles { get { return _batch.Files.Where(x => x.VersionNormalizedFileName == FileName && !x.IsDeleted).ToList(); } private set { } }\[/code\]PdfMergerViewModel.cs\[code\] FileData fd = new FileData(new BatchData()); void createOutputBackgroundWorker_DoWork(object sender, DoWorkEventArgs e) { using (StreamReader sr = File.OpenText("D:/data.txt")) { String input; while ((input = sr.ReadLine()) != null) { string[] stringArray = input.Split(','); for (int i = 0; i < stringArray.Count() - 1; i++) { } } } }\[/code\]I need to put the "fd" object inside the for loop and assign the values for each property in "FileData.cs". I don't know how to assign the value. Provide me a solution. Thanks.Previously "Dictionary" used. Now we are changing to object oriented approach. The following code is used when dictionary item is present. Now, instead of dictionary, I need to use the object oriented approach to assign the values in "FileData.cs" class.Code which used Dictionary Item:\[code\] Dictionary<string, string> item = new Dictionary<string, string>(); for (int i = 0; i < stringArray.Count() - 1; i++) { item.Add(RemoveQuote(stringArray), RemoveQuote(stringArray[i + 1])); i++; }\[/code\]Instead of dictionary, "fd" object, I need to assign the values. I don't know how to assign the value. Provide me a solution. Thanks.