I'm trying to detect if a particular instance of a Type object is a generic "IEnumerable"...
The best I can come up with is:
// theType might be typeof(IEnumerable<string>) for example... or it might not
bool isGenericEnumerable = theType.GetGenericTypeDefinition() == typeof(IEnumerable<object>).GetGenericTypeDefinition()
if(isGenericE...
Hello,
Normally you use Form.Visible to check if Window is visible at all. But sometimes on the screen window is below other windows so it's really invisible.
So how to check in c# Windows Forms if window is really visible or not?
I would like to accomplish this: when I click CTRL+K on my keyboard and my window is visible on my screen...
Hello,
We're trying to use TransitioningContentControl of Silverlight toolkit in our application.
Almost all the material on the forum shows how to change content of the same control inside the TransitionContentControl.
I have 2 separate grids, Grid1 & Grid 2 on the page and i need to transition each of them.
On the click of a hyperli...
I've got a problem converting an object property to string while using reflection...
string value = Convert.ToString(typeof(T).GetProperty(ValueField).GetValue(data, null));
This throws 'Object does not match target type.' when returning any type other than string?
...
Currently I am working with a custom business object layer (adopting the facade pattern) in which the object's properties are loaded from stored procedures as well as provide a place for business logic. This has been working well in the attempt to move our code base to a more tiered and standardized application model but feel that this ...
ASP.NET MVC 2 will support validation based on DataAnnotation attributes like this:
public class User
{
[Required]
[StringLength(200)]
public string Name { get; set; }
}
How can I check that a current model state is valid using only pure .NET (not using MVC binding, controller methods, etc.)?
Ideally, it would be a single...
Note, this question is a bit subtle so read it carefully: I'm not just trying to find out whether some artibitrary type implements IEnumerable:
Here's a function I've written with an initial implementation:
// is "toType" some sort of sequence that would be satisfied
// by an array of type T? If so, what is the type of T?
/...
Data comes in by email as a zipped file. The Java solution we wrote tried to parse and download the email automatically and load the data. We ran into all kinds of problems getting through the firewall, and eventually the solution just got put on hold. Because the administrators wouldn’t allow access to an anonymous type of email box.
T...
I am using Graphics.DrawString to draw my usercontrol's text like this:
protected override void OnPaint(PaintEventArgs e)
{
RectangleF bounds = DisplayRectangle;
bounds.Inflate(-4, -4); // Padding
StringFormat format = new StringFormat();
format.Alignment = StringAlignment.Near;
format.LineAlignment = StringAlignment...
I have a class called Question that has a property called Type. Based on this type, I want to render the question to html in a specific way (multiple choice = radio buttons, multiple answer = checkboxes, etc...). I started out with a single RenderHtml method that called sub-methods depending on the question type, but I'm thinking separat...
According to http://www.codeguru.com/forum/showthread.php?t=463663 , C#'s getHashCode function in 3.5 is implemented as:
public override unsafe int GetHashCode()
{
fixed (char* str = ((char*) this))
{
char* chPtr = str;
int num = 0x15051505;
int num2 = num;
int* numPtr = (int*) chPtr;
for ...
Hello,
I have a vb.net Winforms application. I also have a compiled help file (chm) file that I created using RoboHelp 6.0.
I want to open to a specific help topic and so to do that I am using the following code.
System.Windows.Forms.Help.ShowHelp(Me, "MyHelpFile.chm",HelpNavigator.KeywordIndex, "MyTopic")
Of course I am using var...
I'm working on a small console utility to upload batches of data to our hosted SQL server. The total data size can get up to several megabytes. I'd like a way to display the progress of the SaveChanges operation. Is there any way I can do this with the Entity Framework? If not, any recommendations would be appreciated.
...
I've successfully configured my clickonce deployed application to run on system startup by adding a registry key to: SOFTWARE\Microsoft\Windows\CurrentVersion\Run\.
However, when the system starts my app runs before networking is available. Is there anyway for me to configure this so that my app waits for networking resources to beco...
Is there anyone out there that can answer some questions for me? I am trying to make the workflow take different paths automatically based on values in accruent form fields, but I need to write some code or something. It's not working, and there is no documentation or help files at all. Not even online at SKelta's site. Help!
...
In C# 3.0, is it possible to determine whether an instance of Type represents an Anonymous Type?
...
Is there any support for XAML on the Windows Mobile?
...
I can't quite think of how to phrase the question to be precise, but hopefully my meaning will be clear. Do Control.SuspendLayout and Control.ResumeLayout keep count?
To put it another way, If I call SuspendLayout twice, and ResumeLayout once, is layout still suspended?
...
I'm messing around with some windows functions using p/invoke. Occasionally, I get an error code that is not ERROR_SUCCESS (such an odd name).
Is there a way to look these up within the program? Forexample, if I get error 1017. Can I tell the user
The system has attempted to load or
restore a file into the registry, but
the spec...
I'm having an issue extracting a substring in SQL query results.
Here's the situation: I have a column that contains strings in the following format "ax123456uhba", "ax54232hrg", "ax274895rt", "ax938477ed1", "ax73662633wnn2"
I need to extract the numerical string that is preceded and followed by letters. However, occasionally there is...