Same error from my C# - Unsafe code may only appear if compiling with /unsafe - eddyho-88@hotmail.com

Answered Same error from my C# - Unsafe code may only appear if compiling with /unsafe - eddyho-88@hotmail.com

  • Tuesday, December 07, 2010 3:10 AM
     
     
    class Test
    {
        public int num;
        public Test(int i) { num = i; }
    }

    class FixedCode
    {
        class Program
        {
            unsafe static void Main(string[] args)
            {
                Test o = new Test(19);
                fixed (int* p = &o.num)
                {
                    Console.WriteLine("Initial value of o.num is " + *p);
                    *p = 10;
                    Console.WriteLine("New value of o.num is " + *p);
                }
            }
        }
    }
    Error    1    Unsafe code may only appear if compiling with /unsafe    C:\Documents and Settings\Eddy  Ho\My Documents\Visual Studio 2010\Projects\608-FixedCode\608-FixedCode\Program.cs    13    28    608-FixedCode


    class UnsafeCode
    {
          unsafe static void Main()     
          {
            int count = 99;
            int* p;
            p = &count;
            Console.WriteLine("Initial value of count is " + *p);
            *p = 10;
            Console.WriteLine("New value of count is " + *p);
          }
    }
    Error    1    Unsafe code may only appear if compiling with /unsafe    C:\Documents and Settings\Eddy  Ho\My Documents\Visual Studio 2010\Projects\608-UnsafeCode\608-UnsafeCode-Errors\Program.cs    5    26    608-UnsafeCode

    class PtrArithDemo
    {
        unsafe static void Main()
        //static void Main(string[] args)
        {
            int x;
            int i;
            double d;

            int* ip = &i;
            double* fp = &d;

            Console.WriteLine("int   double\n");
            for (x = 0; x < 10; x++)
            {
                Console.WriteLine((uint)(ip) + " " + (uint)(fp));
                ip++;
                fp++;
            }
           
        }
    }
    Error    1    Unsafe code may only appear if compiling with /unsafe    C:\Documents and Settings\Eddy  Ho\My Documents\Visual Studio 2010\Projects\610-PtrArithDemo\610-PtrArithDemo\Program.cs    5    24    610-PtrArithDemo
    • Moved by Shrikant Maske Tuesday, December 07, 2010 9:15 AM Not related to this forum (From:Forums Issues (not product support))
    •  

All Replies

  • Tuesday, December 07, 2010 9:13 AM
     
     Answered

     Hi,

    Thank you for your post!  I would suggest posting your question in one of the MS Forum,

    located here:  http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/threads

    Have a great day!


    Shrikant Maske, Tier 2 Application Support, Server and Tools Online Operations Team
  • Tuesday, December 07, 2010 10:43 AM
     
     
    hi, I have a problem please i need help. my question is simple i have a request on access that countains information about students and note of many subjet . So i need to print on each page information of each student and his notes , I th ought to use group in the cristal report to display information of a student on each page but i have to display the informations in an array i don't know how . Thank you for helping me

    Loubnas
  • Tuesday, December 07, 2010 11:41 AM
     
     

    Hi Loubnas,

    Please do not post multiple post for same question, I would suggest you to post your question in one of the Microsoft forum,

    Visual Studio Developer Center > Visual Studio Forums > Crystal Reports for Visual Studio
    Have a great day !

    Shrikant Maske, Tier 2 Application Support, Server and Tools Online Operations Team
  • Tuesday, December 07, 2010 11:47 AM
     
     
    ok i will, could you help me please or you prefer i post it on this forum i need help

    Loubnas
  • Tuesday, December 07, 2010 11:50 AM
     
     
    because there is no body who respond me and i have to find a solution because i work on it
    Loubnas
  • Tuesday, December 07, 2010 12:30 PM
     
     
    any suggestions please
    Loubnas
  • Tuesday, December 07, 2010 1:08 PM
     
     Answered

    Hi Loubnas,

    As suggested in earlier post , please start a new thread in forum  http://social.msdn.microsoft.com/Forums/en-US/vscrystalreports/threads , and wait for some time, you will get the reply for your post.

     Or check answered threads in the forum which may have answer of your query.

    Thank you for your patience.


    Shrikant Maske, Tier 2 Application Support, Server and Tools Online Operations Team
  • Tuesday, December 07, 2010 1:12 PM
     
     
    Ok thank you for responding me
    Loubnas
  • Wednesday, December 08, 2010 1:48 PM
     
     

    Thanks for the detailed information. I am newbie here... I am good in programming you can ask me anytime i am willing to help.

    Scott Gostyla