473,396 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Return strong type (like typed dataset)

9
I have a class that accepts objects via an add method and then stores them in a list of objects:

Expand|Select|Wrap|Line Numbers
  1. public class tagBuilder
  2. private _store as Dictionary(Of String, Object)
  3.  
  4. public sub Add(tagName as string, tagValue as object)
  5. _store.add(tagName, tagValue)
  6. end sub
  7.  
  8. end class
  9.  
I would like to add some methods that allow me to return a strong type (string, int, date) based on the specified tag. Is this possible? Doesn't a typed dataset do something similar based on the column datatype?

Expand|Select|Wrap|Line Numbers
  1. public function GetTag(tagName as string)
  2. ' pseudocode: 
  3. ' - search _store for tagName
  4. ' - get value into object
  5. ' - cast object to actual type and return
  6. end function
  7.  
Mar 5 '08 #1
1 945
fsx
9
Sorry, I think i've done a bad job of describing this.

I'm wondering if I need code generation to create me methods that will return expected tags. for example, a string "username" tag would be returned with .GetUserName() [ as string] and a date "dob" tag would be returned with .GetDob() [ as date].

The original idea was to get a strong typed back instead of an object and then cast it to a type.
Mar 5 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Freeon | last post by:
Hi, I am looking for a way to sort a strong typed dataset. It would seem the most straightforward way is to use a dataview. The only problem is when I use the dataview I seem to loose the strong...
3
by: Chris Thunell | last post by:
I have 2 forms, on 1 form i use the wizards to create a strong typed dataset with tables from an SQL database... and from that i can do stuff like: me.daEmployee.fill(me.dataset11.tblEmployee) ...
3
by: Freeon | last post by:
Hi, I am looking for a way to sort a strong typed dataset. It would seem the most straightforward way is to use a dataview. The only problem is when I use the dataview I seem to loose the strong...
1
by: Steve | last post by:
I have a windows CE application, talking to a C# WebService. In the WebService project I have created a dataset (dsJobList), and there is a web method in there which returns a fully loaded...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.