I know I can't write a method like:
public var MyMethod()
{
return new{ Property1 = "test", Property2="test"};
}
I can do it otherwise:
public object MyMethod()
{
return new{ Property1 = "test", Property2="test"}
}
but I don't want to do the second option because, if I do so, I will have to use reflection.
Why I want to do...
I have a new application written in java that needs to read encrypted values out of a db. The problem is that all the values in the db were encrypted by .NET code that uses the ANSI x923 padding scheme. I have done some research and it doesn't look like the Java TripleDes libraries have a way to specify this padding scheme. I was wond...
I am working on a project and have to compare two files and see if they match eachother excatly.
My first draft before alot of error checking and validation came up with:
DirectoryInfo di = new DirectoryInfo(Environment.CurrentDirectory + "\\TestArea\\");
FileInfo[] files = di.GetFiles(filename + ".*");
FileInfo outputFile = fil...
i have a column item-code, inside my database which i have bound to a datagrid view. The item-code comes in this format "A-B-C", i wish only to show the "B" part of the code, i have bound this column to the gridview and now wish to make it show the substring. I tried defaultcellstyle.format but don't know how to get a substring for it.
...
Hello,
Has anyone attempted using JQuery dialog to display crystal reports in .Net 2.0? Also, the crystal report viewer is within an AJAX update panel. We are trying to implement that and having nightmarish issues with printing and exporting the reports. If I use full postbacks from the report viewer, it closes the JQuery dialog. If I u...
What happens in memory when we pass a value type - which has been stored on the stack - by reference?
A temp value/pointer must be created somewhere to change the origninal value when the method completes. Could someone please explain or point me to the answer - lots of stuff on memory but none seem to answer this. ty
...
Hi,
I currently need to provide a means of adding extensibility in my application. I'm currently looking at MEF and MAF.
MEF provides a simpler programming model, and also fits our usage scenarios better as we only want to load addins into a single AppDomain - this is due to the way the system has been architected. The same thing can...
Consider the requirement to strip invalid characters from a string. The characters just need to be removed and replace with blank or string.Empty.
char[] BAD_CHARS = new char[] { '!', '@', '#', '$', '%', '_' }; //simple example
foreach (char bad in BAD_CHARS)
{
if (someString.Contains(bad))
someString = someString.Replace(bad...
class Person
{
public string FirstName { get; set; }
public string LastName { get; set; }
}
List<Person> theList = populate it with a list of Person objects
How can I get a string which contains all the FirstName of the objects in the list separated by a comma. Eg:
John,Peter,Jack
A basic solution would be to iterate through ea...
I've got a user that is not able to launch our ClickOnce application (there are thousands of users that can just fine). They are not receiving any errors nor does the ClickOnce installation dialog display. The only thing that happens when they click the button to launch it is a progress bar shows up in the bottom of the screen saying tha...
Is there any way of detecting that a debugger is running in memory?
and here comes the on Form Load pseudocode.
if debugger.IsRunning then
Application.exit
end if
Edit: The original title was "Detecting an in memory debugger"
...
Is there any potential for issues when having multiple threads read static values or can they be read by any number of threads concurrently without issues? (C#)
...
I have created a .NET application designed to use the RemoveFromSQLServer function to delete DTS packages from a SQL server. This is the entirety of the code:
Sub Main()
Dim app As New Application
app.RemoveFromSqlServer("dts_rob_temp", "MyServer", Nothing, Nothing)
End Sub
When I try to run it, I get the below fairly undescri...
What is the safest (and shortest) way do lock read/write access to static members in a multithreaded environment in C#?
Is it possible to do the threadsafe locking & unlocking on class level (so I don't keep repeating lock/unlock code every time static member access is needed)?
Edit: Sample code would be great :)
Edit: Should I use t...
When should I use volatile/Thread.MemoryBarrier() for thread safety?
...
So after a lot of searching, trying and failing I've finally got the recipe down for creating a COM visible .net dll file, signing it and installing it (via cab and an exe) via IE such that you can use the control inside IE.
Problem now is, it won't run at the default IE security level (Vista/Windows7). I got a thawte Authenticode cert...
I have a value converter that formats numbers (I can't use SP1 yet unfortunately). It works fine until it gets a percentage.
Here's an example:
<TextBlock Text="{Binding Path=PercentageComplete,
Converter={StaticResource NumberFormatter},
ConverterParameter='0.00 %'}" />
Unfortunat...
I am trying to get the HTTP status code number from the HttpWebResponse object returned from a HttpWebRequest. I was hoping to get the actual numbers (200, 301,302, 404, etc.) rather than the text description. ("Ok", "MovedPermanently", etc.) Is the number buried in a property somewhere in the response object? Any ideas other than cr...
Let's say I have the following code
static class ...
{
static object myobj = new object();
static void mymethod()
{
lock(myobj)
{
// my code....
}
}
}
Then let's say that while thread1 has the lock thread2 tries to run mymethod.
Will it wait for the lock to be released or throw an e...
I've created an object with 100+ elements and not all of them are showing up in the final XML after serialization. What can I add to the [XmlElement] decorator to make sure it is in the final XML even if it is empty?
...