Click here to Skip to main content
15,893,814 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionConverting a string into a method Pin
treddie10-May-13 20:54
treddie10-May-13 20:54 
AnswerRe: Converting a string into a method Pin
NeverJustHere11-May-13 0:04
NeverJustHere11-May-13 0:04 
GeneralRe: Converting a string into a method Pin
treddie11-May-13 17:05
treddie11-May-13 17:05 
GeneralRe: Converting a string into a method Pin
Dave Kreskowiak11-May-13 19:18
mveDave Kreskowiak11-May-13 19:18 
GeneralRe: Converting a string into a method Pin
treddie11-May-13 21:36
treddie11-May-13 21:36 
GeneralRe: Converting a string into a method Pin
Dave Kreskowiak12-May-13 4:55
mveDave Kreskowiak12-May-13 4:55 
GeneralRe: Converting a string into a method Pin
treddie13-May-13 11:13
treddie13-May-13 11:13 
GeneralRe: Converting a string into a method Pin
Dave Kreskowiak13-May-13 12:18
mveDave Kreskowiak13-May-13 12:18 
Not so useful. Actually, pretty limiting in both security and performance.

First, it's poor-performing code as it has to be compiled before use, at runtime. Access to variables might also have to be done through reflection as you REALLY don't want to run this code in the same AppDomain as the application code because of HUGE security problems with running user-enterable code in an app. Google for "SQL Injection attacks" for examples on how bad this is. The compile-time compiler also cannot possibly predict the contents of a string so it cannot pre-compile anything, wasting more time. You MIGHT get away with a caching scheme to improve performance a little bit, kind of like how strings are stored, but again, you'd have to be able to store the string with the compiled code so you have a quick lookup of the string version of the code as a key.

Oh, and you also lose type-safety and Intellisense.


If you think you need to do this in your application code, it's generally taken as a sign your code design is DEEPLY flawed.

GeneralRe: Converting a string into a method Pin
treddie13-May-13 13:06
treddie13-May-13 13:06 
GeneralRe: Converting a string into a method Pin
Dave Kreskowiak13-May-13 18:26
mveDave Kreskowiak13-May-13 18:26 
GeneralRe: Converting a string into a method Pin
treddie14-May-13 19:34
treddie14-May-13 19:34 
GeneralRe: Converting a string into a method Pin
treddie11-May-13 21:42
treddie11-May-13 21:42 
AnswerRe: Converting a string into a method Pin
dusty_dex11-May-13 0:30
dusty_dex11-May-13 0:30 
GeneralRe: Converting a string into a method Pin
treddie11-May-13 17:07
treddie11-May-13 17:07 
GeneralRe: Converting a string into a method Pin
dusty_dex12-May-13 0:01
dusty_dex12-May-13 0:01 
GeneralRe: Converting a string into a method Pin
treddie12-May-13 0:44
treddie12-May-13 0:44 
GeneralRe: Converting a string into a method Pin
dusty_dex12-May-13 1:05
dusty_dex12-May-13 1:05 
GeneralRe: Converting a string into a method Pin
treddie13-May-13 10:13
treddie13-May-13 10:13 
GeneralRe: Converting a string into a method Pin
dusty_dex13-May-13 10:50
dusty_dex13-May-13 10:50 
GeneralRe: Converting a string into a method Pin
treddie13-May-13 11:14
treddie13-May-13 11:14 
AnswerRe: Converting a string into a method Pin
Eddy Vluggen11-May-13 22:22
professionalEddy Vluggen11-May-13 22:22 
GeneralRe: Converting a string into a method Pin
treddie12-May-13 0:53
treddie12-May-13 0:53 
GeneralRe: Converting a string into a method Pin
Eddy Vluggen12-May-13 1:05
professionalEddy Vluggen12-May-13 1:05 
GeneralRe: Converting a string into a method Pin
treddie13-May-13 10:10
treddie13-May-13 10:10 
GeneralRe: Converting a string into a method Pin
Dave Kreskowiak13-May-13 12:19
mveDave Kreskowiak13-May-13 12:19 

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.