473,386 Members | 1,715 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,386 software developers and data experts.

How to change string to property name?

I want to change the string name to property name..
for example
Expand|Select|Wrap|Line Numbers
  1.  
  2. public class Code
  3. {
  4. public int RD{get;set;}
  5.  
  6. public Code()
  7. {
  8.    GetCode();
  9. }
  10.  
  11. private void GetCode()
  12. {
  13. string cd= "RD";
  14. cd=1; // cd represent to property name "RD" 
  15. }
  16.  
  17. }
  18.  
Apr 23 '12 #1
2 2131
Expand|Select|Wrap|Line Numbers
  1. public class code
  2. {
  3. public int RD { get; set; }
  4. }
  5.  
  6. public class CodeProgram
  7. {
  8. public static void main()
  9. {
  10. code cd = new code();
  11. cd.RD=1;
  12. Console.Write{"{0}",cd.RD);
  13. }
  14. }
  15.  
Apr 24 '12 #2
RhysW
70
rekedtechie all that does it write the string to the console, which isn't even close to what he wants, i'm assuming from his description he wants to be able to type in a string and have that string used to create a property with the inputted string as its name, unfortunately i don't think this is even possible to do.

During runtime the program runs the code that it already has, you can't add more to it or take it away, can i ask WHY you are trying to make a specific name for a property? perhaps if we understand more about what you are doing we can provide other ways to do it.

RhysW
Apr 24 '12 #3

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

Similar topics

3
by: Antonio Paglia | last post by:
Imaginate you have one method that accept some arguments like: 1- a control 2- un Type (MyType) 3- el nombre de una Propiedad "PropertyName" Example: ...
2
by: Jennyfer J Barco | last post by:
Hello, I have the following: <HEAD id="ENGINE"> <title>WebBase.NET Engine</title> <meta content="Microsoft Visual Studio.NET 7.0" name="GENERATOR"> <meta content="Visual Basic 7.0"...
4
by: Bill Borg | last post by:
Hello, I've got a simple shared property, e.g. Public Class dbObject Private Const m_ID As String = "ID" Public Shared ReadOnly Property ID() As String Get Return m_ID End Get End Property
6
by: Aaron Smith | last post by:
Ok. I have a dataset that has multiple tables in it. In one of the child tables, I have a column that I added to the DataSet (Not in the DataSource). This column does not need to be stored in the...
7
by: JohnR | last post by:
I have a user defined class that contains about 20 private variables with their associated properties and get-sets. I have named the properties with very user readable names. I would like to...
5
by: Joe | last post by:
Is there anyway to change the name or add a property to and existing class in .NET 1.1? For example if I have a property called Name and I want to change it to MyName. -Joe
1
by: Jim M | last post by:
After learning that the 'subdatasheet name' property set to "" can adversely effect database speed, I wanted to send a small code snippent to my end users to reset the SubdatasheetName Property so...
1
by: j_mmtz | last post by:
Hi, i need to change the internal name of an application VB Net in visual studio 2005, but i can't find this option if it exists, please can somebody help me?. thanks.
7
by: Nemisis | last post by:
Hi everyone, Can anyone tell me if it is possible to pass in a property of an object into a sub, and within that sub, find out the name of the item that was passed along with the property name??...
2
Jezternz
by: Jezternz | last post by:
OK. I have made a function here that will suposedly go down the stylesheet and change particular properties. However I want to be able to make the property name defined when the function is called....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: 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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...

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.