|
The only way to do that would be to get the type name as a string, and examine it. Two types derived from the same generic type are still two completely different types, there is no grouping of types.
Why do you want to know if the object is derived from a specfic generic type? You still can't use the object for anything based on that information. You have to cast the object to some specific class or interface to be able to do anything with it except what the Object class provides.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
Guffa wrote: The only way to do that would be to get the type name as a string, and examine it.
I was able to do a little better. someObj.GetType() == typeof( Foo<> ) actually works.
Guffa wrote: Why do you want to know if the object is derived from a specfic generic type? You still can't use the object for anything based on that information.
Indeed, sounds like we have a design flaw. Thanks for your input.
|
|
|
|
|
|
Swap the parameters, you have them in the wrong order.
client = new Client(sm, sc, txtThread2, btnStart, btnStop);
client = new Client(sc, sm, txtThread2, btnStart, btnStop);
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
hi,
please can you help me to create my own xmp in an existing pdf document with C#.
Thanks
|
|
|
|
|
What is an xmp ?
You'll need to buy or find a library that works with PDFs.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hello, Can someone tell me how I can display local current date and time from user's machine, not server's time, using C#? I am developing a web form that when accessed by user will display his local time. Basically I am looking for the Javascript equivalent of GetCurrentDateTime(). The format I will need is 2/15/2008 1:38 PM. Any help is appreciated. Thanks!
|
|
|
|
|
|
Hello, Sorry for typo. I meant to say I am looking for the C# equivalent of GetCurrentDateTime() (javascript function).
|
|
|
|
|
tjkota wrote: date and time from user's machine, not server's time
So you do want the servers time?
tjkota wrote: date and time from user's machine, not server's time
led mike
|
|
|
|
|
hi, no, I don't want server time. I want machine time that can be obtained using Javascript's GetCurrentDateTime(). Can you suggest a way to obtain the same using C# or suggest a way to pass Javascript value to C# server?
|
|
|
|
|
What is this some sort of joke?
tjkota wrote: suggest a way to pass Javascript value to C# server?
tjkota wrote: I am developing a web form that when accessed by user will display his local time.
One does not need to get the time in Javascript from the Browser to send it to the server to display it in the Browser. If you figure out what you actually need that makes any sort of sense maybe you can let us know.
led mike
|
|
|
|
|
Okay, Mike, here is what I need. I will need to display on my form each visitor's respective date and time. I kind of know that this can only be achieved by a client-side script like Javascript (eg, GetCurrentDateTime()).Upon submission of the form I am exporting the html form to word document and sending as an attachment. When I export form to word, the date time value loaded by Javascript (on a label) doesn't get exported, strangely. I will need to figure out a way to pass the datetime value from javascript to ASP.NET and then display it on the form. This will then surely get exported to word. I hope this makes sense. Thanks.
|
|
|
|
|
tjkota wrote: Okay, Mike, here is what I need.
Great. In the future see if you can post what you need in fewer than 4 posts.
Using ASP.NET to send data from the browser to the Server you can use any number of ASP.NET form controls.
For example you can use a hidden TextBox control that has attached to it the javascript that will fill the text value of the control when it executes in the browser.
Now when the form is submitted back to the ASPX page the data is available to the code behind in the .Value property of the control. Of course this value is type "string" not Date.
You can use the C# Date object to parse the string so that you can use the resulting Date object to format the Date in any way you like for output as a "string" to the "Word" ( I guess that means a Microsoft Word Document).
led mike
|
|
|
|
|
led mike wrote: Great. In the future see if you can post what you need in fewer than 4 posts.
Hey - that would sort of bring his post count down.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
There is an ItemMouseHover event for listview but there isn't any ItemMouseLeave event. I want to change my listview item colors without actally clicking on them first. Thanks
|
|
|
|
|
Color the one your on however you want, then return the color to normal when you hover over a new one. This requires you to remember the last item the mouse was over.
|
|
|
|
|
Hello AGAIN again again:
there aren't articles (that I've found, honestly) about an input class in XNA. Can someone PLEASE tell me how to exit a game from a second class, with classes A and B, A being the Game1 and B being Input. I'm tired of looking around without luck. Thanks for at least reading.
- I love D-flat!
|
|
|
|
|
|
Most of those articles focus on methods to do this which I know, not classes, and what page is the Ziggyware article on?
- I love D-flat!
modified on Friday, February 15, 2008 3:18 PM
|
|
|
|
|
There is no article that exactly matches your question, but it's a pretty basic one.
To exit a game all you need to do is something like
if(Keyboard.GetState().IsKeyDown(Keys.Escape))
Game.Exit();
So basically you just need a Game instance variable to be available anywhere in your app, for example by using a static variable.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I've tried that (for the main class) in other classes with this exact code, but it doesn't exit.
- I love D-flat!
|
|
|
|
|
Really, your game shouldn't be exiting from a child class. Any child classes should be notifying the parent classes that an exit is required. Your top level code should be doing the cleanup and exiting.
|
|
|
|
|
Really? I thought everything for input goes in the Input class.ShouldI keep input unified with the main class?
- I love D-flat!
|
|
|
|
|
Exiting an application is not input. It's more of a "command" or "request". It's up to the input processor to create the appropriate command to send back to the main loop of your game.
|
|
|
|