|
Urggg. Seems MSDN is down for me, tried some other links now, same result...
|
|
|
|
|
Finally got it loaded, interesting. Thankfully they have a big warning to show that you should not normally have to use this for equality comparison.
|
|
|
|
|
Hi all
I am trying to save my settings into app.config but it doesn't work. I can read data but I can't save it. I see no error.
Can you give me a hint. Here is my code.
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
config.AppSettings.Settings.Remove("ClientPort");
config.AppSettings.Settings.Add("test", "23232");
config.Save(ConfigurationSaveMode.Full, true);
ConfigurationManager.RefreshSection("appSettings");
Thanks.
|
|
|
|
|
daavena wrote: ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
User based .config files live in another location, somewhere in Documents and Settings/Username/blah/blah.
You probably want to use: PerUserRoamingAndLocal
|
|
|
|
|
I used directx capture dll ,now i want to compress any format ,how to diffreent from one to another audio codecs ,
for example some audio codecs listed in listbox .i want which one is selected the file is created that format ie) if selected mp3 compresser file name is like www.mp3 if selected wma compresser file name is like www.wma
regards
anish...
|
|
|
|
|
I'm sorry, I can't work out what you're asking. You want to have a listbox of codecs and work out what filenames to give them ?
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
how can i convert .wav file to .raw
|
|
|
|
|
There is nothing built in. You need to buy a tool, or a library, or write a converter.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Hello Frnds,
I want to add two numbers through Generic. Im giving my code here plz let me knw my mistake and also suggest the way to come out of this problem
static void Main(string[] args)
{
Addtion<int> e=new Addtion<int>();
e.get(10,20);
Addtion<double> e1=new Addtion<double>();
e1.get(2.5,5.2);
Console.ReadLine();
}
class Addtion<T>
{
public void get(T a,T b)
{
T c = a +b;
Console.WriteLine(c);
//Console.WriteLine(b);
}
}
It's throwing an error
Operator '+' cant be applied to operands of type 'T' and 'T'
|
|
|
|
|
T can be anything, including types which do not have operator + defined. Therefore, this doesn't work ( and is kind of dumb anyhow ). You can specify that T is a struct, or class, or impliments a certain interface, but I don't believe you can actually specify that it impliments +.
class Addition<T> where T : IDisposable
for example, will reject anything that does not impliment IDisposable, and so you can do
T.Dispose();
in your class, because you've defined it will be there. I am guessing you're looking for a simple example to play with generics, sorry the one you picked does not work. The only thing you know for sure about T is that it's an object, unless you add other constraints to your definition. You can try to cast T, but you can't assume anything else is there, unless you said it would be.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Welcome to one of the issues people have with generics, you can't apply operands to them. There is a reason for this, and Christian has defined it perfectly. Part of it is understanding what a plus actually does; i.e. an addition on a vector class would behave differently to an addition on a string. I've typically seen this coded around using a variant of:
public void Add(T a, T b)
{
if (typeof(T) == typeof(int))
{
return Add((int)a, (int)b);
}
}
public int Add(int a, int b)
{
return a + b;
} It's not pretty, and pretty much negates the use of generics in this instance.
|
|
|
|
|
|
Hey everybody
I'm really stuck with a problem that sounds pretty simple. Any kind of help with the problem (directing to an article) will be great!!!
I want to catch ALL EXCEPTION in my winform application, so in the worst case scenario the exception will be print to the debug viewer and won't throw the application.
In the application I'm using threads I'm creating, and threads that are being created for events. So there I can't think of a certain "root" place I can use try-catch in order to catch all the different exceptions.
Another other idea is to create "myThread" (something like that), and use only these threads to run everything, but threads in events are not being created by me (is there a way to change that?!).
As you can see, I'm a bit lost here...
Any help would be great!!!!
Thanks in advance!
|
|
|
|
|
You catch those exceptions by catching an event on your main form. Of course, that means when you log, you'll be at the root of your app, which makes recovery more difficult, although not impossible.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
What are some of the best known tools available to detect memory leaks. I know of a couple like "Rational Purify" and Insure++. Any relative comparison figuring out the best preferably the ones which work better in terms of saving time and focus more on multi threaded environments.
|
|
|
|
|
This is not an exact answer to your question but you may use CLRProfiler for a quick check on your application. But if you are on a comprehensive project I am not sure if this tool would help...
Regards,
Always keep the Murphy Rules in mind!
|
|
|
|
|
It is a big comprhensive projects with millions of lines and 100 of vcproj in it.
|
|
|
|
|
tom groezer wrote: It is a big comprhensive projects with millions of lines and 100 of vcproj in it.
Then you are clearly in the wrong place! Now head off to the C++ forum.
|
|
|
|
|
Hi
my problem is i did'nt find any Good resourece for API i must learn structured storage API so i will use this function "StgIsStorage" "StgOpenStorage" but the prammeter of that functions i dont know what the value i will give it , i found it so complex
can u help me pleasegt
Thankx
Amani
|
|
|
|
|
That's a very loose question. www.pinvoke.net has the p/invoke signatures to call these methods from C#. The MSDN and other sites have examples of the sort of values you pass when you use these methods.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Hi All,
I got two txt files that are StreamReader into my program, now i would like to compare those two files line by line, however, the following codes are not working coz it won't loop the first while loop until the second while loop finishes.
StreamReader sr = new StreamReader("c:\\asmx\\Hand_Written_Result.txt");
StreamReader sr1 = new StreamReader("c:\\asmx\\Auto_Generated_Result.txt");
while ((line = sr.ReadLine()) != null)
{
while ((line_1 = sr1.ReadLine()) != null)
{
Assert.AreEqual(line, line_1);
i++;
}
i++;
}
Thanks a lot
|
|
|
|
|
Your approach seems not correct.
You may try this one:
while (sr != sr.EndOfStream || sr1 != sr1.EndOfStream)
{
line = sr.ReadLine();
line_1 = sr1.ReadLine();
if(!String.IsNullOrEmpty(line) && !String.IsNullOrEmpty(line_1))
{
Assert.AreEqual(line, line_1)
}
}
Hope this helps,
Always keep the Murphy Rules in mind!
|
|
|
|
|
|
It appears you don't understand while loops. I recommend reading up on them.
one possible solution is
while(line = sr.ReadLine() != null && line_1 = sr1.ReadLine() != null)
{
]
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|