|
I would suggest to use relevant title so that other people can benefit it 
|
|
|
|
|
"Callback" is the delegate. I have a calculated string which give the function name and I want to pass this string to delegate. How can I achive this. Please advice
String FunctionName ="Myfunction"
String FunctionID="5679"
FunctionName = FunctionName + "_" +FunctionID
cbk->m_pCallBack = gcnew Callback(this, FunctionName);
Please advice
|
|
|
|
|
What you ask is tricky, tedious and ugly, and I would suggest you to find a better approach. That said, I think I can give you some clues for what you are asking for, though I have not tested it:
Since you have the function name, you might use reflection to get its MethodInfo object. The MethodInfo has a property called MethodHandle, which returns a RuntimeMethodHandle object. This object can give you an IntPtr function pointer just invoking its GetFunctionPointer method, and you can convert this IntPtr function pointer to a delegate using Marshal.GetDelegateForFunctionPointer. As I said before, tricky, tedious and ugly. If you explain us a little more of what you want to do, maybe we can help you to find a better solution.
|
|
|
|
|
//function names string array
static array<String^>^ FunctionNames = gcnew array<String^> {
"&MyClass::Function_1",
"&MyClass::Function_2",
"&MyClass::Function_3",
"&MyClass::Function_4",
"&MyClass::Function_5",
.....
"&MyClass::Function_40"
};
array<FLE^> ^ entry = gcnew array<FLE^>(40);
for each (String^ FuncName in FunctionNames)
{
String FunctionName ="Myfunction"
String FunctionID="Count.ToString();
FunctionName = FunctionName + "_" +FunctionID="
cbk->m_pCallBack = gcnew Callback(this, FunctionName);
m_FL->Add(FunctionID, entry[iCount]);
iCount++;
}
|
|
|
|
|
I see you are storing the function names into a string array. Why don't you use a Dictionary<string, callback=""> to store the pair? The string representing the function name would be the key, and the corresponding delegate for that function would be the value. It would be much easier than what you pretend to do.
|
|
|
|
|
Some more info on what you are trying to achieve would be helpfull.
|
|
|
|
|
I am using ASP.Net 2008, and I want to connect Database SQL Server 2000 But when i add new database connection "Network related - Or Instance specific error occurred while establishing connection to the SQL Server." error comes. and when I connect to SQL Server 2005 it works properly. Anyone know the solution.
thanks
|
|
|
|
|
if you can connect with odbcad32.exe, then go to connectionstrings.com as your connection string is not correct.
|
|
|
|
|
Dear All,
I have the follow data in my Dataset1.Table(0)
col1 Col2 Col3 Col4 Col5 Qty
SS 111 SIN C 20 114
SS 111 SIN C 40 28
SS 111 SIN S 20 165
SS 111 SIN S 40 189
I want to SUM(Qty) those are same color
The result will like below
SSUM 111 SGSIN 20 279 (row1 + row3)
SSUM 111 SGSIN 40 217 (row2 + row4)
I don’t want to loop and sum row by row. Is there any DataTable Method to get my result?
If I use like this how will be my result?
Dataset1.Table(0).Compute("Sum(Qty)","Group by Col1,Col2,Col3,Col5")
Please, any suggestion for the best way.
Thanks and Best Regards
|
|
|
|
|
|
|
Hello,
Today I've noticed something interesting to me and I'd like to understand.
Let's say I have a function like this one:
public enum SomeEnum
{
Value1 = 0,
Value2 = 1
}
public void DoSomething(SomeEnum theEnum)
{
if(theEnum == SomeEnum.Value1)
return;
}
When I build the project which is a ClassLibrary in Debug mode the compiler translates that to:
public void DoSomething(SomeEnum theEnum)
{
if(theEnum == 0)
{
return;
}
}
But when I build the same project in Release mode the result is:
public void DoSomething(SomeEnum theEnum)
{
if(theEnum == null)
{
return;
}
}
This seems to happen only when the Enum has two values.
Anyone?
Thanks.
|
|
|
|
|
_Zorro_ wrote: the compiler translates that to...
I doubt that very much. How do you make such observation?
if reflector is involved (which version?), have a look at the IL code itself (not the decompiled "source" code), and show it here.
|
|
|
|
|
Sorry for the delay, didn't checked my mail in a while
Ok, I had to be drunk that day, even if i'm pretty sure of what I saw I am unable to reproduce that issue today... It's been an hour I'm trying with no success so I'll leave it there.
I shouldn't have deleted my test project...
Thank's to you both for your answers and happy new year!
|
|
|
|
|
Also doubt that, especially since the optimizing compiler is likely to change the test to !theEnum instead of using the == operator.
|
|
|
|
|
|
Hi guys, now am in a remoting project. I need to transfer a TreeNode control using remoting.
Is it possible in remoting i don't know, if any one know explain me
Thanks in advance
ganesh_IT
|
|
|
|
|
I have this C# application that has been compiled as "AnyCPU". No problem running it on my 32bit machines. Nor my 64-bit machines. But a friend of mine is having a strange issue where the app seem to be forced into 32-bit-mode (TaskManager marks it with "(*32)"). This in turn causes a "BadImageFormatException" when a pice of code relying on a external DLL is loaded (during install the correct .dll file is copied based on wether Windows is 64 or 32 bit). CorFlags tell me that the application isnt force to 32bit, so why the heck is it running as 32 bit on a 64 bit OS?! (and yes, the .Net framework is installed for both 64 and 32 bit on the machine in question).
|
|
|
|
|
Because AnyCPU will compile to target the lowest common denominator of supported hardware which is 32 bit.
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
No it doesn't, you will get something that will run in 32bit mode on 32bit platforms and 64bit mode on 64bit platforms.
IMO it's a shame it's the default, many programs actually can't run in 64bit mode at all but were never tested.
|
|
|
|
|
By default, this option is set to AnyCPU (Any CPU in C#), which specifies that the compiler should not optimize compilation for a specific CPU type.
I are Troll
|
|
|
|
|
Hi,
The "video download dll" (here and here) returns the download link for the video with the best qualitiy(e.g. 1080p). Is there a posibility to get the stream links for the other links(e.g. 240p, 320p, 720p)?
Thanks
|
|
|
|
|
Why don't you ask the author?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Ok, good argument.
I've added the same question on the codeproject article. But of course I am still looking for a solution .
|
|
|
|
|
Just needing a little hand over here!
After some disgusting moments with test and release team I've found out that there were some DB objects that where not updated across different environments so I'm thinking, as a developer who wants to have good practices , to create a tool to compare different objects, in this case stored procedures, but I'm in need of a tool to compare texts. I was looking for something like XMLDiff but for texts!
I'm thinking on coding like Unit tests (probably on NUnit) just to make a checkup on released objects, I could be testing also for aspx and js files! but wanted more like a signaling tool to only point which files or objects have differences between environments/installations. Do you know of any tool that could be of use? I'm not using plane String.Equals because I'd like to check for spaces, line-breaks but also not being too strict on them, that's what I mean when I said I wanted something like XMLDiff
I'm thinking on building it on .Net so any suggestions are really appreciated!
|
|
|
|