.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

does dot net has pointers

Posted By:      Posted Date: September 20, 2010    Points: 0   Category :ASP.Net

doses c# dotnet has pointers if yes how can we use it , please give an example

View Complete Post

More Related Resource Links

Interop Marshalling of C++ with pointers in the structure

I have a vendor supplied dll that is written in C++. I need to use it in a C# application and am trying to use Interop. I have .h files and example .cpp code from the SDK, but I'm clearly in over my head. There are dozens of functions defined in this API, but if I can just get started on how to do this, I'd appreciate some guidance. My biggest headeache is pointers. Here's examples of the C++ and how far I got with C# (which i'm sure I totally botched) MY.h: part of the included headers typedef struct my_handle *MY_Handle; MY_API_PUBLIC int _cdecl MY_HandleCreate(MY_Handle *my_handle, const char *serial_number, const char *client_id, const char *product_type, const char *product_version); MY_API_PUBLIC int _cdecl MY_HandleDestroy(MY_Handle *my_handle); MY_API_PUBLIC int _cdecl MY_Init(void); MY_API_PUBLIC int _cdecl MY_Shutdown(void); MY.cpp: some example functions. int MY_Init(void); int MY_HandleCreate(MY_Handle *my_handle, const char *serial_number, const char *client_id, const char *product_type, const char *product_version); int MY_HandleDestroy(MY_Handle *my_handle); int MY_Shutdown(void); MY.cs: The class created to house the interop stuff. class MYClass { //MY_Init() [DllImport("ts.dll", SetLastError = true)] public static extern int MY_Init(); //MY_Shutdown() [DllImport("ts.dll", SetLastError

How to pass double pointers for COM Interop via MethodInfo.Invoke ?

Hello, I need to make COM IntetrOp at runtime using reflections. My native COM Object's exposed methods have some parameters as pointers (DWORD*) and some double pointers (DWORD**) and some are user defined types(e.g SomeUDTType objSmeUDTType) and its pointer to pointer(i.e. SomeUDTType **pSomeUDTType). I need to pass pointers to pointers. For now how can I be able to populate "object" array as pointers to pointers of SomeUDTType. Working Example:      STDMETHODIMP MyCallableMethod(DWORD *value_1,BSTR *bstrName,WESContext **a_wesContext tlbImp.exe generated output:      DTINIDLLib.RuntimeCallingClass.MyCallableMethod(ref uint, ref string, System.IntrPtr) Regards UsmanMutlithreading

Problem : Need to make COM InterOp at runtime using reflections Passing Pointers as parameters?

Hello, I need to make COM IntetrOp at runtime using reflections. My native COM Object's exposed methods have some parameters as pointers (DWORD*) and some double pointers (DWORD**) and some are user defined types(e.g SomeUDTType objSmeUDTType) and vice versa its pointer(i.e. SomeUDTType *pSomeUDTType). Now for dynamic method invocation, we have single option for passing parameters as array of object i.e object[] and filling this array statically. But I need to pass pointers and references and pointers to pointers. For now how can I be able to populate object array as mixed data of simple data types, pointers or references and pointers to pointers. Working Example: Native COM exposed method : STDMETHODIMP MyCallableMethod(DWORD *value_1,BSTR *bstrName,WESContext a_wesContex Translated by tlbimp.exe (COMInterop) UDTINIDLLib.RuntimeCallingClass.MyCallableMethod(ref uint, ref string, UDTINIDLLib Now calling these methods at runtime using reflection at runtime, See here :        Assembly asembly = Assembly.LoadFrom("E:\\UDTInIDL\\Debug\\UDTINIDLLib.dll");         Type[] types = asembly.GetTypes();         Type type = null;    //foreach (Type oType in types)         {             try      &nb

Why do we say delegates are type safe as compared pointers???


Two questions:

  •  Why do we say delegates are type safe as compared pointers ?
  • Can we define a pointer in C# ?

Sharepoint Designer: Pointers on creating a Workflow


Hi all

Can someone give me some pointers on how to create this (simplified) workflow?

When an Item is created in a Calendar it should create a task in a Task List.
If that task is Approved it should send an email to the person who created the item in the calendar

and if the task was Rejected it should Delete the item in the calendar.

I can get to creating the Task but I am not sure whether I should then have a second WF linked to the task list?

Some help would be greatly appreciated.
PS: I am using Sharepoint Designer 2010 with Sharepoint Foundation

Can anyone provide details of or pointers to a framework for data to winforms over the internet?

I know Robin and others deploy winforms apps to client workstations using clickonce which then interact with distant databases for the usual crud stuff. I am interested in evaluating this approach but it does not seem to be a modality that is covered very well...or at least I've not found a lot of sources.

Can anyone share the details of how they handle data interactions for these kinds of applications? Or, are there frameworks out there that have been developed with the winforms - internet - server topology in mind?

There were some MS apps (one was named taskmanager or something like that) that demo'd this kind of approach, but I think they are rather stale at this point or defunct as examples. I know the approach is viable and is used for commercial apps. I would love to find an app with source code that I could study and learn from.

It may be that silverlight with ria services will ripen soon...in theory that's close to what I'm looking for. But it looks pretty raw at this point. I'm pretty new to .net dev and I'm sure I'd learn a lot from building some winforms - internet - server apps in the next year, regardless of what approach I take later.

Pointers on writing server control


Hi again,

So...I'm a little stuck here, with my first server control. I'll just post the whole thing, as I'm sure I've done plenty of mistakes. The main thing for me to find out is if there's a more elegang way to write this.

What I'm trying to accomplish here is to write a panel with custom HTML inside it. Inside the custom HTML, I need to put some server controls I can actually reach. My attempt at finding the span  in the code failed, so there's obviously something wrong.

I hope I can get some help, as I can see so many cool usages for this :D


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;
using System.Web.UI;
using System.Web.UI.HtmlControls;

namespace ModalPopup
    [ToolboxData("<{0}:FacebookPopup runat=server></{0}:FacebookPopup>")]
    public class FacebookPopup : CompositeControl
        protected override void OnInit(EventArgs e)

            this.EnsureChildControls(); // << This is it! This makes ViewState work for a CompositeControl
        protected override void OnLoad(EventArgs e)
            if (!this.Page.IsPostBack)
                // Set value once to test whether it's pr

If you have a n dimension array - how do you make it efficient? Do you run out of pointers?


I have a program that needs to create an array of arbitrary dimension.  In other words, if you pass 2 to a routine, that routine has to allocate a 2 dimensional array.  

So I wrote a routine to do this.  Lets assume for simplicity that every dimension has the same number of values.  And lets suppose that if we want to get a value out of this array, we pass the indices as an array too.

So for example, if we have a 3 dimensional array, and we want to access array(3,2,7) we pass an one dimensional array that has 3,2,and 7 in it.

I've found a way to do this, but it requires a lot of multiplications to find the index.  So I thought of an alternative, which is this:

Select Case n
 Case 1
  dim ArrayN(0) as integer
 Case 2
  dim ArrayN(0)(0) as integer
 Case 3
  dim ArrayN(0)(0)(0) as integer
 Case Else

COM interop: issue with C-style array of interface pointers


Dear community,

I have an issue with COM interop. I need to marshal a C-Style array of interface pointers.  I have changed IL to get this array marshaled correctly but I have issues accessing the array elements in the managed code.  Below are the IDL as well as my three tries that did not work.

Any suggestions?



[local] HRESULT Next([in] ULONG cElems, [out] ISomeObject *prgElems, [out] ULONG *pcFetched); \

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend