Click here to Skip to main content
15,906,816 members
Everything / Reference

Reference

reference

Great Reads

by Giovanni Scerra
Patterns to prevent null reference exceptions
by Shivprasad koirala
Difference between BasicHttpBinding and WsHttpBinding.
by Vlad Neculai Vizitiu
A discussion of "init" keyword introduced in C# 9

Latest Articles

by Vlad Neculai Vizitiu
A discussion of "init" keyword introduced in C# 9
by Giovanni Scerra
Patterns to prevent null reference exceptions
by Shivprasad koirala
Difference between BasicHttpBinding and WsHttpBinding.

All Articles

Sort by Score

Reference 

26 Feb 2015 by Giovanni Scerra
Patterns to prevent null reference exceptions
13 Jan 2016 by Aescleal
Run, don't walk to your nearest second hand bookshop and/or ebay. Look for "Programming Windows" by Charles Petzold (5th edition) and buy a copy. It'll show you how to write Windows programs in C - it'll take you through how to write applications using the WIN32 API. Don't buy the 6th edition -...
13 Jan 2016 by Richard MacCutchan
See: EFNet #Winprog[^] and Win32 Programming - FunctionX[^]. google will, no doubt, find you others.
2 Dec 2014 by Richard MacCutchan
Then you should report it in the Article Writing or Spam and Abuse forum.
2 Dec 2014 by Kornfeld Eliyahu Peter
It is simple plagiarism and should be reported here: http://www.codeproject.com/Forums/1652005/Spam-and-Abuse-Watch.aspx[^]Good catch!
2 Dec 2014 by Sergey Alexandrovich Kryukov
The fairness of it is at least questionable. Even when it might be legal, the use of the images without mentioning the source of it is unacceptable ethically. Even such a simple image can be considered as a creative act, so using it without mention of the original source can be considered as...
13 Jan 2016 by CPallini
I would use Google for that.Actually I did, and found this page: Win32 Tutorial - Recommended Books and References[^].
13 Jan 2016 by StephenJElliott
I searched with Google for "C++ tutorials" and I found the following which might be useful for you:C++ Language - C++ TutorialsDepending on your particular compiler, it might be useful to find a nice example. For graphics with MFC and Visual Studio 12 C++, for example, there is the...
28 Sep 2015 by Sergey Alexandrovich Kryukov
You need to understand the following: parameters are passed by references only if ref or out is specified. So, your statement is incorrect: the objects, even the objects (instances) of classes are passed be value in all other cases. You just need to understand what it means.Still, the class...
2 Dec 2014 by Eric Ouellet
This code project article:A Beginners Guide to Bitmaps[^]Seems to have copied information from:http://paulbourke.net/dataformats/bitmaps/[^]I haven't seen the reference of it. I wonder if it is fair? Eric
24 Aug 2015 by Dave Kreskowiak
There is no assembly to add a reference to. NativeWifi is part of Windows and accessible through P/Invoking the various functions. There is no assembly in the .NET Framework that wraps that functionality.There is, however, a third party wrapper you can use here[^], though it hasn't been...
15 Sep 2016 by CPallini
You never assign a valid value to the COMPort variable.You should do soemthing similar toCOMPort = New SerialPort()' set the various parameters of the serial port hereSee SerialPort Class (System.IO.Ports)[^].
7 Nov 2016 by #realJSOP
Well, Direct3DX does not exist in the DirectX namespace. To verify this, you can open up the Direct3D dll in the Visual Studio object browser, and see for yourself.
6 Mar 2019 by CPallini
Quote: strcpy ( c, &c[6] ) ; In the above line you are misusing strcpy. From the documentation[^]: To avoid overflows, the size of the array pointed by destination shall be long enough to contain the same C string as source (including the terminating null character), and should not overlap in...
15 May 2019 by OriginalGriff
This is C, not C# or C++: you don't have references - all parameters in C are passed by value (i.e. a copy of the variable content is passed to the function, not the variable itself). To pass a "reference" you pass the address of the variable and receive it in the function as a pointer: void...
15 Feb 2021 by amirea
I need to keep references in unmanaged code to objects on managed side, like handles. There are going to be approx. 10,000,000 objects. I'm not familiar with interop, initially I thought it was as simple as declaring ref SomeClass on C# side...
15 Feb 2021 by KarstenK
You shouldnt do that this way, but really think hard about using so many objects at once. If you really need that heavy load than you better code the program in one language to get best performance with that many objects. Else you can use the...
23 Jul 2022 by OriginalGriff
The problem is simple: the main project references the shared project already - so when you try to add a reference to the main project in the shared project it creates a circular reference: A refers to B which refers to A which refers to B which...
26 Jan 2015 by Kornfeld Eliyahu Peter
.NET assemblies are loaded by the CRL engine upon demand, so not much to do there...However there is an AssemblyResolve[^] event of the application domain, that event may help you to handle the missing reference...Please also read...
27 Jan 2015 by BillW33
The interop components are not guaranteed to be present, even if Office is installed. You should include Microsoft.Office.Interop.Excel as part of your program’s installer. Read here[^] for more details on interops. When your program is running check the registry to determine if Office is...
28 Sep 2015 by Patrick70__
OK this is something not related with WPF but on the basis of C#. I knew that classes are ALWAYS passed by reference differently from structs that are passed by value.If you take a look at the following code you can see that I call a function with no REF keyword (supposedly there's no need...
6 Feb 2016 by Sergey Alexandrovich Kryukov
Please see my comment to the question. Is anything unclear?The problem is here:this.passwrdchange((System.Nullable)(obj.ID)), default(string), default(string), ref default(System.Nullable);Here, your ref parameter is not assignable variable. This is the constant defined by...
21 Jul 2016 by OriginalGriff
The reference is separate from the using statement - the reference tells the system what assembly files to include, while the using is a "syntactic sugar" which lets you writeusing MyAssembly;and then useMyClass mc = new MyClass();Instead of having to write the full name each...
21 Oct 2016 by Nelek
You should have got a notification per email explaining the reasons for closing the article.Usual reasons are:poor cuality, big issues with format, spam, plagiarism...seeing that your account still is active I think it is more related to quality / content instead of being punishable...
2 Feb 2017 by CPallini
It takes a reference to a pointer (to int).Try, for instance:#include using namespace std;void MyFunc(int * & data) {data++;}int main (){ int a [] = { 12, 15, 27, 42 }; int * p = &a[2]; cout
2 Feb 2017 by Jochen Arndt
You have to pass a reference to an int*:int someVal = 123;int *pSomeVal = &someVal;MyFunc(pSomeVal);Because a reference must be an lvalue, you must create a variable rather than just passing the address of a variable which is not an lvalue.Because your function is incrementing the...
10 Aug 2017 by BillWoodruff
The compiler is telling you that it has not completed compiling the Class, and the Method body you try to reference is not available. Create a Constructor for the Class and set the reference to the Method there: public partial class ScreenShotConfigurationForm : Form { private const int...
25 Jul 2021 by Chris Copeland
.NET optimizes out library references where they haven't been used. So if your "LibraryA" references a particular package but chooses not to use it, it may be optimized out of the DLL when compiled in release mode. I think the correct approach...
3 Mar 2022 by CPallini
You correctly pass the reference, but didn't use a static field (as explicitly required) for storing the balance. Moreover I suppose it's best to work with integers (using cents of dollar as unit of measure) instead of doubles. Try...
26 Dec 2014 by 28shivamsharma
Suppose I have an Object obj1. Now I have its hashCode() stored in variable. Now I want to access obj1 through hashcode only.Means get a reference of that object. Is there way of doing such way!!!
23 Feb 2015 by Bond487
Hi, I am developing a large windows form application. It contains more than 20 Class library. Whenever I made changes on any one of the library function, then I supposed to clean and rebuild all other class library's which refers. Some times I need to delete the reference and supposed to...
23 Feb 2015 by Sergey Alexandrovich Kryukov
No, you don't need to clear and rebuild all. The build is incremental, based on time stamps and detection of real change in the sources, unless you explicitly command the full rebuild, instead of build. Besides, C# compilation and build is so fast that it's hard to believe that it really "spoils...
7 Apr 2015 by stixoffire
I have a 3rd party client library which encompasses 2 DLL's.I have two applications that I am creating , with a business object library.One application is a service which communicates with a specific industrial device requiring the 3rd party libraries. My service and my application will...
30 Apr 2015 by ahamednafeel
Hello,I am Creating a small project which is created in C#. I am having a DLL file by the use of DLL file, I have to call the functions and methods and Make that project as a new DLL. I done this But the problem is The C# code is converted to net module it shows two errors. I am not clear...
30 Apr 2015 by OriginalGriff
Start differently: Use VS to add a new project to your solution, and tell it to create a class library. It will then create a project with a default "class1" which you can modify to fit your needs as it will contain a valid basic file framework. When you build it, it will produce a .NET DLL...
21 Jun 2015 by Sergey Alexandrovich Kryukov
You are passing first argument as reference. It means that the actual argument should be an object that can be referenced, it can not be an immediate constant such as 5. Passing by reference allows the function modify the value of this argument, so it should be a variable.You should either...
29 Jul 2015 by SuperSlavik
Good day,Please, indicate: can local reference variables increase performance of .NET applications? In particular, is Method2, indicated below, faster than Method1? What are drawbacks of Method2 regarding memory usage and the GarbageCollector?public void Method1(){ for (int i =...
29 Jul 2015 by E.F. Nijboer
Indeed you should check the IL to see if there are any differences. My guess would be there aren't because the temp variable item would in compiled code be a processor register. If the compiler is any good it will recognize the OuterObject.InnerList[i] repetition and won't reload it all starting...
29 Jul 2015 by OriginalGriff
That's actually a difficult question to answer, because it's not as simple as "do this, it'll be quicker". And the reason why is called "optimization". Just as you "optimize out" the dereference and array index access into a local variable in creating the second version, so can the compiler....
14 Aug 2015 by mayank.bhuvnesh
HiI have defined a class "Seller" in this I am using a public string variable aspublic string _connectionString = ConfigurationManager.ConnectionStrings["seller"].ConnectionString.ToString();The above connection string is defined in App.config file used in class library Seller.When I...
17 Aug 2015 by Attie.Snyders
I am still a bit of a noob. I have a main app that loads plugins. I want to validate that all the Reference DLL's required to run the plugin exists in the Main App directory before I launch the plugin and if not, download it from a location. Where I struggle is to get a list of...
17 Aug 2015 by sreeyush sudhakaran
Have a look at these links :Using Reflection to load unreferenced assemblies at runtime in...
24 Aug 2015 by Coder1999
Hello. I can't find where the Nativewifi reference is in visual studio. Does someone know what reference NativeWifi is part of?
2 Sep 2015 by F-ES Sitecore
Right-click on HttpWebRequest and from the context-menu select Resolve. Under the resolve menu there will be an option for adding the correct using (using System.Net) so select that.
2 Sep 2015 by ZurdoDev
HttpWebRequest is in System.Net, https://msdn.microsoft.com/en-us/library/system.net.httpwebrequest(v=vs.110).aspx[^].If you have that as a reference then add the using statement. You should also get a little blue (as I recall) underline underneath the beginning of the line of code where...
5 Jan 2016 by amagitech
I have an A project and I used itextSharp for this project I have an code like below public static string PdfOku(string _link) { StringBuilder _stringBuilder = new StringBuilder(); PdfReader _pdfReader = new PdfReader(_link); for (int page =...
5 Jan 2016 by amagitech
I solved my problem. It is about dll versions.I had installed itextsharp.dll v5.8.0.0 on my B project using ManageNuGet Paackages.and also my B project has itextsharp.dll v5.0.5.0 .I deleted itextsharp.dll v5.8.0.0 and I used same itextsharp.dll .
6 Feb 2016 by Deepak Kanswal Sharma
I'm Calling a stored procedure for password change. But it is giving me Error.What I have tried:And On Button Click My Function is:-protected void BtnSave_Click(object sender, EventArgs e) { using (SampleDataContext dbContext = new SampleDataContext()) { ...
28 Apr 2016 by FriendOfAsherah
I have a function that needs a reference as a parameter like Editfield( BYTE& value, .... )works OK as long I use direct access in getter /setter with BYTE& as return like __declspec (property (put = _SetPropsText, get = _GetPropsText)) BYTE propsText; void _SetPropsText(BYTE val) {...
28 Apr 2016 by bling
Short answer is: you can't and shouldn't.The purpose of getter / setter is to have the getter / setter code act as barrier or gatekeeper. Some getter / setters compute a return value or have multiple side effects. There might not be an actual private variable.What you can do is work with...
15 Sep 2016 by Member 12292743
Dim withevents COMPort as SerialPortDim comOpen as BooleanPrivate Sub Form1_FormClosed(ByVal sender as object, ByVal e As System.Windows.Forms.FormCLosedEventArgs)Handles Me.FormClosedWith COMPort .POrtName = "COM20" various other propertiesEnd withIf COMPort.IsOpen...
21 Oct 2016 by pvala
Why my last artical closed?? NSE/BSE STOCK MARKET.What I have tried:Why my last artical closed?? NSE/BSE STOCK MARKET.
8 Nov 2016 by Perić Željko
I wanted to draw some plain 2D text inside 3D sceene.For that I need Microsoft.DirectX.Direct3D.Font class, but to be able to acess to that class I need also to add reference Microsoft.DirectX.Direct3DX to the project.I have added these three references to my solution using...
1 Dec 2016 by RydenChoi
Hello! I made a sharepoint winform application(reference Microsoft.SharePoint.dll version 12.0)I already registered that dll using gacutil.In my PC, SharePoint 2016 is installed, in Visual studio, build and run application is okay.But when I try to run some button event,...
16 Dec 2016 by mmbguide
helloI have added several references to my project and when I compile my project, all DLLs must be exist next to my EXE file in the same folder. how can I define another path for my references.EXE Path = ...\TestDLL Path = ...\Test\Resources\DLLI want to put my DLL in another path...
15 Dec 2016 by Richard MacCutchan
DLL files are loaded at run time, not compile time, so they need to be located by Windows. This means they must be in the same directory as the executable file or in one of the directories named in the environment PATH variable.
16 Dec 2016 by mmbguide
helloI use this code in my App.Config but dose not work. help me please
24 Jul 2017 by Member 13324136
Hi all! I want to create a bst which contains an object (box) with 2 parameters (x and y), when the x is the parameter that the bst is based on, and the y is a parameter associated to the specific leaf in the tree via linked list. For example, if I have 3 objects: 1- (x=4, y=6), 2- (x=4, y=7),...
24 Jul 2017 by Member 13324136
First answer: The idea is that when I compare 2 boxes I will begin with comparing the X values, and if they are the same, I will compare the Y values. That's the way I will know if the new box is bigger than the previous one or not. Second answer: So what you are saying is that instead of...
10 Aug 2017 by willy wonka 2
In Microsoft c# 2008 I have the following code into a Form: using System; using System.Diagnostics; using System.Drawing; using System.IO; using System.Media; using System.Reflection; using System.Runtime.InteropServices; using System.Windows.Forms; namespace ScreenShots { public partial...
12 Sep 2017 by OriginalGriff
Answered only to remove from unanswered queue: solved by OP.
8 Feb 2018 by Rodolfo Colón
I'm Using Microsoft Visual Studio 2017, In the project I'm calling Service reference from SAPME WEB service, recently we did an patch on SAPME. and now the service is not retrieving all the information in each single object. I have tested the reference in SOAP UI, and here the web service yes...
23 Aug 2018 by ckrandhir
I followed this link https://aspdotnetcodehelp.wordpress.com/2017/03/27/how-to-access-wcf-service-in-asp-net-core-application/ Only difference is my WCF has to pass usename and password to authenticate What I have tried: I followed this link...
11 Nov 2018 by TheBigBearNow
Hello, I am getting the error object reference is not set to a instance I am creating a new customer in the combobox select method but in the button click I go to update the customer but I get an error where I am updating the customer object. The error is here in this btn click: this exact...
11 Nov 2018 by Aydin Homay
Hi I am more suspicious to the below line: ComboboxState.SelectedValue.ToString() Could you please do a favor and re-write your code in this way: var userId = currentUser.UserID; var firstName = TextboxFirstName.Text; var lastName = TextboxLastName.Text; var address = TextboxAddress.Text;...
6 Mar 2019 by Member 13995616
#include using namespace std ; int main () { char *c = new char(100); strcpy( c , (char*)"http://localhost:4000/index.html") ; strcpy ( c, &c[6] ) ; printf(" url is %s\n" , c ) ; return 0 ; } This code outputs : url is /localhost:ndex.htmlx.html What I have tried: I...
6 Mar 2019 by Shao Voon Wong
Rule of thumb: you should avoid strcpy to itself. You use 2 different variables for the parameters. That should solve the strangeness.
6 Mar 2019 by KarstenK
This is NOT strange but "works as designed". The backslash is a special sign which isnt valid in plain strings but signals some special characters following. To handle it correct you need to add a second backslash for EACH single backslash. Like that: strcpy( c ,...
10 Apr 2019 by Member 14150748
Greetings! As tittle says, I need to marshal an struct within a pointer to another struct (actually,. a vector to another struct). That one is got after certain message (related question here), with it address as LParam. It definition is in a .dll file made by a thirdparty (dont have source...
10 Apr 2019 by Member 14150748
Solving stuff by myself (yup, I'm a library mice!) I defined the pointer to vector as an IntPtr (see 2nd C# struct implementation in previous post). Then: switch ((int)msg.WParam) { /* Other cases */ case (int)WMPAR.ImagesReady: Images img; if (scanner.getImage(m.LParam, out...
15 May 2019 by dj4400
Hi, I have a C application. I want to build an init function which creates handles to events which will be used outside the init function Something like this: InitEvents(HANDLE hEvent1, char *Event1Name, HANDLE hEvent2, char *Event2Name) { hEvent1 = CreateEvent(..Event1Name...); ...
8 Jan 2020 by Audiory Researcho
Hi Experts I have a C++ template class CompositeElement that contains a field / property CompositeElement** (pointer to pointer). I know that it is not the exact intention of composite to consist a data structure holding multidimensional polymorphic derivations and/or template specializations...
27 Nov 2020 by xhon
I created a .NET ASP MVC 5 web app and installed Unity. A UnityConfig.cs created inside the App_Start folder of the app and I configured and registered the components I need. Now I created another .NET ASP MVC 5 web application inside the same...
27 Nov 2020 by Richard Deeming
Tools ⇒ NuGet Package Manager ⇒ Manage NuGet Packages for Solution... Select the "Installed" page, and then select the Unity.Mvc5 package. On the right-hand side, you'll see that the package is ticked for your old project, but not for your new...
24 Feb 2021 by tomtomGIS
I have 1,000 polygons and 1,000 poly points or single points defined within QGIS 3.16 I want to add to each shape a geofence. I want to track movement events as one gps locator moves in or out of the defined geofences. example: a ship is...
14 Apr 2021 by dejf111
Hello, I have a problem. I'm trying to create a math game in WPF Application. The point is that when I start the game opens a window where there is a choice of four options (addition, multiplication, subtraction and division). Clicking on one of...
14 Apr 2021 by Kenneth Haugland
This is WPF and you should be using bindings to do this. That way your previous settings would just be a property in your code that you easily can get. Also I would definitly recommend using PRISM to separate your code into different ViewModels.
28 Jul 2021 by acalafiore
Hi all, first time asking a question but I wasn't able to find a solution to my problem yet. We are starting a new project in .NET and we choose to divide it in differente libraries to maintain it easily. Or so we hope. To keep it as simple as...
28 Jul 2021 by acalafiore
I have chosen to include in each solution the project needed for references. This way there are no missing libraries while running. Not really what I wanted but it's the easiest way.
4 Mar 2022 by bazi aeflin
Code instructions: The Coin class will act as the base class. Three child classes will be created using the Coin class as the base class. The classes will be Quarter, Dime, and Nickel. These child classes will contain a constructor that will be...
3 Mar 2022 by OriginalGriff
Compiling does not mean your code is right! :laugh: Think of the development process as writing an email: compiling successfully means that you wrote the email in the right language - English, rather than German for example - not that the email...
23 Jul 2022 by ernteSKY
I have my Main Project where are some Forms and Classes. I also created some Shared Library projects (.dll) in the same Solution. I can access any kind of Shared Library projects from my Main Project. Of corse all of them added as a Reference...
23 Jul 2022 by Dave Kreskowiak
DO NOT DO THIS! Setting a reference from the Shared Library project to the main project is indicative of bad design, violating encapsulation and separation of concerns. The library project should know nothing at all about whatever project is...
26 Jan 2023 by DrgIonuţ
I am trying to establish a connection to InfluxDB database. After I publish my c# MVC app on IIS and run it, I get this error: Quote: System.IO.FileLoadException Message : Could not load file or assembly 'netstandard, Version=2.1.0.0,...
26 Jan 2023 by OriginalGriff
You are specifically telling it to load an assembly "netstandard" Version=2.1.0.0 and the error message is pretty specific: The located assembly's manifest definition does not match the assembly reference. Which means that the versions don't...
26 Jan 2023 by Richard Deeming
You're referencing a library or NuGet package which is build for .NET Standard 2.1; that library doesn't support any version of .NET Framework. .NET Standard | Microsoft Learn[^] You need to check your project's dependencies.
18 Jun 2012 by Shivprasad koirala
Difference between BasicHttpBinding and WsHttpBinding.
16 Dec 2015 by Afzaal Ahmad Zeeshan
The problem is with your object, not with the string. When you create the array, you just created it, you forgot to initialize the objects in the array. Movie[] m1 = new Movie[10];But when you try to access the items from it, like, m1[i].Title = Convert.ToString(Console.ReadLine());It...
26 Jan 2015 by Marcin1199
HelloI have external library (not DLL but whole project). This project uses Office Interop. But software will be opened also on computers without Office installed. In this case I want just gray out excel export function. How can I do this?
15 May 2019 by CPallini
You may also pass an array of struct to your InitEvents function, something like (but more robust) typedef struct { HANDLE handle; char * name; } Event; void InitEvents(Event event[], size_t event_count) { event[0].handle = ... event[0].name = ... event[1].handle = ... ...
7 Apr 2015 by Sergey Alexandrovich Kryukov
First of all, you don't reference DLL's, you only reference assemblies. Do you think there is no difference? There is… An assembly usually has one module, which can be .DLL, .EXE (you can freely reference an assembly by an .EXE module — did you know that? in some cases, rather exotic...
26 Dec 2014 by Zoltán Zörgő
Hastables[^] are just a form of collection. It is like an associative array. It des not replace references, but it is using references. The hashcode is used do generate a kind of index to the object, but the object itself is linked into the structure by it's reference. If no reference is kept to...
13 Jan 2016 by Sergey Alexandrovich Kryukov
There are too many books on Windows programming.As to the reference, MSDN works the best: Develop Windows desktop apps – Windows app development[^].—SA
15 Aug 2021 by Vlad Neculai Vizitiu
A discussion of "init" keyword introduced in C# 9
16 Dec 2015 by Leo Chapiro
Static array is very bad, you assume the size will be under 10 but it must not!Take the List as dynamically growing container, try this: static void Main() { //Movie[] m1 = new Movie[10]; List mi = new List(); int...
24 Jan 2016 by Dave Kreskowiak
Which Timer are you using? If it's the System.Windows.Forms.Timer it has to be placed on a Form in order to work.
2 Feb 2017 by Member 12975649
What function argument i have to pass to function Myfunk,c without changing the defition?void MyFunc(int * & data) {data++;}void main () { int a = 5; MyFunc(&a); cout
28 Sep 2015 by Leo Chapiro
An Object if passed as a value type then changes made to the members of the object inside the method are impacted outside the method also. But if the object itself is set to another object or reinitialized then it will not be reflected outside the method. So you need to use "ref" keyword or...
15 Sep 2016 by Patrice T
COMport.IsOPenis weird, you should rather tryCOMport.IsOpenwhich is mire likely.[Update]Use the debugger to see what is COMport when error occurs.You should learn to use the debugger as soon as possible. Rather than guessing what your code is doing, It is time to see your code...
13 Jan 2016 by Member 12261689
I am really in love with c++... :-). recently i got to know about windows programming in c++. I just checked the windows.h header file... Theres a whole lot of stuff there , i couldnt understand anything :(... I was wondering if there was a reference or help file sorta thing to understand the...