Visual C# Language,78
Recent update: 2008-3-21

Does C# provide any unique identifier function?

101 byte By Rosemary at 2008-3-7
Does C# provide any function which will create and return unique identifier? Thanks,

Referencing Value Variables

2560 byte By JimStapleton at 2008-3-6
I want to do something where I can take any variable, reference type (no problem) or value, and have a reference to the data, rather than just the data (in the case of value variables). Example: //create three objects for reference object obj1, obj2, obj3; //create two value variables and one ...

Dispose() and null

708 byte By zheny.lu at 2008-3-5
If I call the "Dispose" method on an object, would it be equal to null? And If I make the object equal to null instead, would it be same as calling "Dispose" method of the object?For example:SomeObject obj1 = SomeObject();SomeObject obj2 = SomeObject();obj1.Dispose();obj2 = ...

'out' vs. 'ref'

74 byte By serghio at 2008-3-3
is there some sample, where can to see the diference between both?

using as operator

56 byte By serghio at 2008-3-1
I can use as opertator, for the objets that I created?.

single instance of form

758 byte By johnk at 2008-2-28
hello,currently i have forms that are selected from a menu but multiple instances seem to be allowed. i would like to have only a single instance of each form allowed, but would like the user to be able to recall the form again after closing the form. other threads on this topic have code that ...

IEnumerable<T> problem

1184 byte By TreyNash at 2008-2-27
Can someone, for the life of me, explain why this code won't compile with CS0305 as the compiler error?Thanks very much, -Trey-using System;using System.Collections.Generic; public class MyContainer<T> : IEnumerable<T>{ public void Add( T item ) { impl.Add( item ); } public void ...

CS0309: constraint has been violated. (possible bug?)

1479 byte By JoeR at 2008-2-26
Does anyone know why the following doesn't work?interface B is derrived from interface A, and should contain an implicit conversion from B to Aerror CS0309: The type 'constraint_bug.interface_b<T>' must be convertible to ...

Problem with sorting a generic List

2269 byte By DeKale at 2008-2-25
The new generics in C# 2.0 are really breath taking, but I've got some problems with sorting a Generic List. I've got a List<KeyValueType<TKey, TValue>>, so this is a list containing another generic type. Now I would like to sort this list by the TKey type of the ...

Generics And Interfaces....

1662 byte By DarrenBlackett at 2008-2-24
I'm currently trying to use generics to make my interfaces a little bit more flexible. Unfortunately I seem to have hit a problem with the compiler complaining when I try to use an interface as an input parameter, if that interface requires a type to be defined. I'm not sure if I explained ...

Creating instance of Generic type using parametised constructor

1465 byte By DaveWaterworth at 2008-2-23
Hi,Why does the code below not work? I've constrained the T type of the Bar class to be a "Foo" but I still get compiler error "Error 1 'T': cannot provide arguments when creating an instance of a variable type" (beta 2 - 8.0.50215.44). Since I've constrained T to be a class rather than ...

From C to unsafe C#

114 byte By Me-myself-I at 2008-2-22
Hi Peter, Thanks for responding. Converting to string doesn't help me convert the code unfortunately. Thanks!

Difference Between C#.Net and C++.Net

315 byte By doug5516 at 2008-2-22
Can someone tell me the primary differences between C#.Net and C++.Net? If I learn one, will I necessarily be learning the other? Which one would you recommend that I learn first? Currently, I know C++ but I program professionally in VB6. I am looking to make the transition into the Visual ...

Question: Generic methods should provide type parameter

1092 byte By bzurer at 2008-2-21
"Generic methods should provide type parameter" http://www.gotdotnet.com/team/fxcop/docs/rules.aspx?version=1.32&url=/Design/GenericMethodsShouldProvideTypeParameter.html public sealed class ReflectionAgent{ public static T GetCustomAttribute<T>(MemberInfo memberInfo) { if (memberInfo ...

I don't understand this code.

1303 byte By MikeF at 2008-2-20
I have a question about a line of code. I was looking at some code on how to implement ftp in .net 2.0 and saw this line of code.response = (FtpWebResponse)request.GetResponse(); my question is, why is FtpWebResponse in parenthisies?Usually you only see parenthisies when you use a method and ...

Setting a property as indexer

3546 byte By DeKale at 2008-2-19
I am trying to create a indexer on a property, but I can't get it working. I want to have something like this: class MyClass { public string Value[string key] { /* Compiler Error */ get { /* Do some processing and Return something. */ } set { /* Set the content to the key value. */ } } } Of ...

Problems In Visual C# coding

2064 byte By Naveenkoul at 2008-2-18
Sir, I have a certain part of code which i have changed to visaul C# from c++ it is giving me some problems.I am not able to understand how to solve it. ...

What is the code to connect Oracle 10g with ASP.NET 2005(Scripting language C#)

558 byte By Amit at 2008-2-18
Hi,I have a wierd problem. I have in my development enviornment, a Windows XP Machine installed with Oracle 10g (both DB and Client on the same machine). The same machine is being used as web server. On this I have a ASP.Net 2005 Application which connects to an Oracle DB and this application works...

Problem with build Web Site

699 byte By SorinSandu at 2008-2-17
When I try to build a web site solution I get the follwing errors :Error 1 (0): error CS0006: Metadata file 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50215\Temporary ASP.NET Files\testeinf\15e74bc9\75b17dc3\App_Web_tzppu2tl.DLL' could not be foundError 2 Metadata file ...

Compiler Warning CS0467

2347 byte By RogerLainson at 2008-2-16
In the following, I get a compiler warning (with VS2005 Beta 2, but not VS2003) on the Close() call. I'm using a reference to Microsoft Word 9.0 Object Library. Word.ApplicationClass WordApp = new Word.ApplicationClass();object missing = System.Reflection.Missing.Value;Word.Document aDoc = ...

Multicast delegates with IEnumator and yield return?

240 byte By BenJoldersma at 2008-2-15
Hello, I am trying do set up a multicast delegate to split my yield returns for a WebTest I am writing, but only the last delegate is firing. Is this a known problem, by design, or am I doing something wrong? Thank you, --ben

Conditional not working, C# Express beta 2

3254 byte By PeterNRoth at 2008-2-15
This code example from help doesnt work; Msg is called every time. AND, the web page editor to post this code also fails, with this messagebox:Line 188Char 1Error: '_ctl0_Maincontent__ctl0_PostForm_PostBodyRichText_Toolba...' is undefinedCode 0Url .../AddPost.aspx?ForumID=59 // ...

Acceptable Posts?

107 byte By PeterNRoth at 2008-2-15
What constitutes acceptable posts to these ngs? Is it acceptable to point out problems with the products?

Mulitplying Large Int64 numbers

2472 byte By HSSGuido at 2008-2-15
When multiplying very large Int64 numbers, I've noticed some strange results.For example, in C# .NET: Int64 lngNumber; lngNumber = 4611686018427387904; lngNumber = lngNumber*2; Console.WriteLine(lngNumber.ToString());Outputs -9223372036854775808Changing the multiplier to 3 as follows: Int64 ...

Could I "inlcude" a C# source file?

326 byte By LeiJiang at 2008-2-15
For example, there are three C# project in my solution, and I want to synchronize their version. What I have to do now is to manually edit "AssemblyInfo.cs" file in every project. If there were a way to "include" a C# file, put information common to all projects in that file, it would be much ...

Conditional not working, C# Express beta 2 && the editor to post this error also fails

3254 byte By PeterNRoth at 2008-2-14
This code example from help doesnt work; Msg is called every time. AND, the web page editor to post this code also fails, with this messagebox:Line 188Char 1Error: '_ctl0_Maincontent__ctl0_PostForm_PostBodyRichText_Toolba...' is undefinedCode 0Url .../AddPost.aspx?ForumID=59 // ...

BSTR type in vc#

787 byte By jan_hk at 2008-2-14
I received a DLL which uses BSTR as string type:example : given in the include file DLLEXPORT BSTR WINAPI I2cGetInterfaceTypeStr (BSTR Interface);how do i access this function in vc#. This doesn't work.[DllImport("I2CAPI32.dll")] public static extern string I2cGetInterfaceTypeStr (string ...

how to change font in visual c#

342 byte By folen at 2008-2-13
am writing a math toolabr i need the "for all symbol" (fliped A) i found it in unicode (at symbol font) but i can't make the program show it (it's shows a small []) i know how ("\uF022".ToString) but it still dosn't show i think i need to change the font or add font but ms word dos and i ...

XML documentation on generics

498 byte By FrederikCarlier at 2008-2-13
Hi,I've been searching the MSDN docs, Googling around and trying to search these forums, but yet have to find an answer to my question.How do you reference a generic class using XML documentation? Obviously, <see cref="System.Collections.Generic.List<T>"/> doesn't work. I tried ...

Generic collection interface rules

4051 byte By JulianMackintosh at 2008-2-12
I am having some problems understanding how to use interfaces within the generic collection framework. I expected the code below to work. public interface Reader { string GetValue(); } public interface ReadWriter : Reader { void SetValue(string value); } public class MyReadWriter : ReadWriter ...

i want to check textbox value matches with database field using sql2005

161 byte By suguna at 2008-2-12
When i am trying to login module it accepts whatever i am entering in the user name. IN ORDER TO RESTRICT THIS I WANT TO COMPARE WITH TEXTBOX WITH DATABASE FIELD

C# Boxing & Unboxing

451 byte By CaptaiNdotNeT at 2008-2-11
Hello, and first of anything please forgive me if my question is very basic, i'm new to the c# programming, and to programming also, and i'm reading inside c# book, but i dont understand:what is the objective of the boxing and unboxing methods, and what are the differences between have a ...

Direct X

96 byte By DukeNukem at 2008-2-10
In the Help there is no information on Direct X? How to me to receive the necessary information?

Removing methods calls off the stack in C#

2007 byte By hbuchal_dotnet at 2008-2-10
How can I remove all the method calls off the stack of an object in C#?I set the variable equal to null but the object is still executing the code.For example if I have onc class calling a method of the other and that calling other methods in that class like this:class A{ private B var; void ...

Can't call indexer property

1216 byte By JensK?hler at 2008-2-8
After recompiling the following code with VS 2005 Beta 2, an C# assembly can't calling the indexer. The code sample works fine with VS 2003. //C++:[System::Reflection::DefaultMember("Parameter")]public __gc class NativeObjectConfigurator : public System::Collections::ArrayList{public: ...

Unicode flood for C# NUnit?

368 byte By Mart_Houston at 2008-2-8
I'm new to C# and NUnits. Can anyone point me in the right direction as to how I can create a loop that passes each and every unicode character of each set one at a time to an api that I'm testing? It seems like the Unicode set are enumorated. Is it possible to use a for each character set ...

Doing arithmetic on generic parameters

1168 byte By dba at 2008-2-7
I'd like to write methods that perform arithmetic operations on generic (but numeric) parameters.The following code produces compiler error CS0019 public T Add<T> (T a, T b) { return a + b;} while this produces compiler error CS0072 public T Add<T> (T a, T b) where T:ValueType{ ...

Problem in retaining the password value

1002 byte By anemvr at 2008-2-7
Hi All,I am using Visual Studio .Net 2003.I am working on Web applications using ASP.Net.In UI design, I have textbox for username and password field, say txtUserName, txtPassword. And also UI Contains one combobox for business entity say cmbBusinessEntity.Following properties are set for above ...

How to change the backround color of treeview control(compact framewrk 2.0)

201 byte By naveen at 2008-2-7
Hi, By default the backroung of treeview control is white...I want to change it to other color Is there a way that we can change the backround color of treeview control(compact frame work 2.0)

Inheritance Issue!!!!!

305 byte By AshokKumarRoy at 2008-2-7
I have a exceptionBase class for application level exception and one data tire baseclass.Now I want to create a class which will inherit both the above base classes.How can I approach thsi?I am using abstract base classes...Please suggets me some guide ...

Can I use multiple inheritance in C#?

305 byte By AshokKumarRoy at 2008-2-7
I have a exceptionBase class for application level exception and one data tire baseclass.Now I want to create a class which will inherit both the above base classes.How can I approach thsi?I am using abstract base classes...Please suggets me some guide ...

Mixing inherited classes and interfaces

979 byte By ThibautBarrère at 2008-2-6
Hello,a former c++ dev in my team is a bit worried by the following code which implies inheriting interfaces, and having inheriting implementations as well.public interface IMyInterface{ /* */}public interface IMyChildInterface : IMyInterface{ /* */}public class MyImpl : IMyInterface{ /* ...

Compiler warning CS0728

890 byte By adamhearn at 2008-2-6
I'm getting a compiler warning with the following code:foo = someOperation();lock( foo ){ ... internalmethod( ref foo ); ...} The warning is:file.cs (3,1): warning CS0728: Possibly incorrect assignment to local 'foo' which is the argument to a using or lock statement. The Dispose call or ...

I want to remove the extra " " between string.... urgent help needed

408 byte By Shanthi at 2008-2-6
I am trying remove the extra " " marks between the string which is in already in " ". The string is in following format "Where are you,"can you help me", please."So i need to remove the middle quotation marks from the string and return the total string.the out...

How to know default value of Type

557 byte By EagleTsui at 2008-2-5
In generic approach I can use default keyword to know what is default valuepublic T GetDefaultValue<T>(){ return default(T);}But if only has a System.Type, I can't use default keyword to do it....public object GetDefaultValue(System.Type dataType){ return default(dataType); //Not ...

Generics and Inheritance question

2821 byte By BrianNewtz at 2008-2-5
K, after an hour or so of playing with generics I've already hit my first snag... How do you declare an abstract property to return an instance of a template class that will be instantiated with the type of the derived class (what a mouthful!)? i.e.: public abstract class Node { public ...

Direct X

193 byte By DukeNukem at 2008-2-4
In language Visual C# 2003 there was a function Pass, in a class Microsoft.DirectX.Direct3D.Effect, and in language Visual C# 2005 this function is absent, what function replaces this function?

Is it possible to wrap a property setter directly with a delegate?

1333 byte By dkocur2 at 2008-2-4
I tried the following without success. I don't want to have to code a separate method just so I can pass the setter function to another class as I'm going to be doing this a lot.public class MyClass{ public delegate void SetStringDelegate( string value); public string MyProperty { get{ return ...

C# Class Factory Design Pattern ,Where from I can get free free resources?

161 byte By AshokKumarRoy at 2008-2-4
Hi I want to explore my skills in c# class factory design pattern . Please help me and provide some free resources. best regards ashok kumar roy

Direct X

56 byte By DukeNukem at 2008-2-4
How to translate files created in 3ds max in a format X?