• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Int32类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Int32的典型用法代码示例。如果您正苦于以下问题:C# Int32类的具体用法?C# Int32怎么用?C# Int32使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Int32类属于命名空间,在下文中一共展示了Int32类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Write

		public override void Write(Int32 val)
		{
			val = Utilities.SwapBytes(val);
			base.Write(val);

			if (AutoFlush) Flush();
		}
开发者ID:svarogg,项目名称:System.Drawing.PSD,代码行数:7,代码来源:BinaryReverseWriter.cs


示例2: OnSuggest

 private void OnSuggest(IPeerWireClient client, Int32 pieceIndex)
 {
     if (SuggestPiece != null)
     {
         SuggestPiece(client, pieceIndex);
     }
 }
开发者ID:HaKDMoDz,项目名称:eStd,代码行数:7,代码来源:FastExtensions.cs


示例3: FindSuffixes

        /// <summary>
        /// Find suffixes in the pattern.
        /// </summary>
        /// <param name="pattern">Pattern for search.</param>
        /// <returns>Suffix array.</returns>
        private static Int32[] FindSuffixes(String pattern)
        {
            Int32 f = 0, g;

            Int32 patternLength = pattern.Length;
            Int32[] suffixes = new Int32[pattern.Length + 1];

            suffixes[patternLength - 1] = patternLength;
            g = patternLength - 1;
            for (Int32 i = patternLength - 2; i >= 0; --i)
            {
                if (i > g && suffixes[i + patternLength - 1 - f] < i - g)
                {
                    suffixes[i] = suffixes[i + patternLength - 1 - f];
                }
                else
                {
                    if (i < g)
                    {
                        g = i;
                    }
                    
                    f = i;

                    while (g >= 0 && (pattern[g] == pattern[g + patternLength - 1 - f]))
                    {
                        --g;
                    }

                    suffixes[i] = f - g;
                }
            }

            return suffixes;
        }
开发者ID:gnikolaropoulos,项目名称:.Net-Labs,代码行数:40,代码来源:BoyerMoore.cs


示例4: BigEndian

        /// <summary>
        /// Converts a <see cref="Int32"/> to big endian notation.
        /// </summary>
        /// <param name="input">The <see cref="Int32"/> to convert.</param>
        /// <returns>The converted <see cref="Int32"/>.</returns>
        public static Int32 BigEndian(Int32 input)
        {
            if (!BitConverter.IsLittleEndian)
                return input;

            return Swap(input);
        }
开发者ID:neokamikai,项目名称:rolib,代码行数:12,代码来源:EndianConverter.cs


示例5: HexNumberToInt32

 private static Boolean HexNumberToInt32(ref NumberBuffer number, ref Int32 value)
 {
     UInt32 passedValue = 0;
     Boolean returnValue = HexNumberToUInt32(ref number, ref passedValue);
     value = (Int32)passedValue;
     return returnValue;
 }
开发者ID:nattress,项目名称:corert,代码行数:7,代码来源:FormatProvider.FormatAndParse.cs


示例6: VerifyInt32ImplicitCastToComplex

        private static void VerifyInt32ImplicitCastToComplex(Int32 value)
        {
            Complex c_cast = value;

            if (false == Support.VerifyRealImaginaryProperties(c_cast, value, 0.0))
            {
                Console.WriteLine("Int32ImplicitCast ({0})" + value);
                Assert.True(false, "Verification Failed");
            }
            else
            {
                if (value != Int32.MaxValue)
                {
                    Complex c_cast_plus = c_cast + 1;
                    if (false == Support.VerifyRealImaginaryProperties(c_cast_plus, value + 1, 0.0))
                    {
                        Console.WriteLine("PLuS + Int32ImplicitCast ({0})" + value);
                        Assert.True(false, "Verification Failed");
                    }
                }

                if (value != Int32.MinValue)
                {
                    Complex c_cast_minus = c_cast - 1;
                    if (false == Support.VerifyRealImaginaryProperties(c_cast_minus, value - 1, 0.0))
                    {
                        Console.WriteLine("Minus - Int32ImplicitCast + 1 ({0})" + value);
                        Assert.True(false, "Verification Failed");
                    }
                }
            }
        }
开发者ID:gitter-badger,项目名称:corefx,代码行数:32,代码来源:implicitExplicitCastOperators.cs


示例7: Distribute

 public static Money[] Distribute(this Money money,
     FractionReceivers fractionReceivers,
     RoundingPlaces roundingPlaces,
     Int32 count)
 {
     return new MoneyDistributor(money, fractionReceivers, roundingPlaces).Distribute(count);
 }
开发者ID:madhon,项目名称:money-type-for-the-clr,代码行数:7,代码来源:MoneyExtensions.cs


示例8: Enter

    public void Enter() {
        // If calling thread already owns the lock, increment recursion count and return
        Int32 threadId = Thread.CurrentThread.ManagedThreadId;
        if (threadId == m_owningThreadId) { m_recursion++; return; }

        // The calling thread doesn't own the lock, try to get it
        SpinWait spinwait = new SpinWait();
        for (Int32 spinCount = 0; spinCount < m_spincount; spinCount++) {
            // If the lock was free, this thread got it; set some state and return
            if (Interlocked.CompareExchange(ref m_waiters, 1, 0) == 0) goto GotLock;

            // Black magic: give other threads a chance to run
            // in hopes that the lock will be released
            spinwait.SpinOnce();
        }

        // Spinning is over and the lock was still not obtained, try one more time
        if (Interlocked.Increment(ref m_waiters) > 1) {
            // Still contention, this thread must wait
            m_waiterLock.WaitOne(); // Wait for the lock; performance hit
            // When this thread wakes, it owns the lock; set some state and return
        }

        GotLock:
        // When a thread gets the lock, we record its ID and
        // indicate that the thread owns the lock once
        m_owningThreadId = threadId; m_recursion = 1;
    }
开发者ID:ppatoria,项目名称:SoftwareDevelopment,代码行数:28,代码来源:SimpleHybridLock1.cs


示例9: Document

 public Document(
     Int16 _TypeId,
     Int64 _Serial,
     Int32 _SignedUser,
     DateTime _Date,
     Boolean _Printed,
     String _DocumentShortName,
     String _DocumentFullName,
     String _MedexDataTable,
     String _DocumentBody,
     String _DocumentHeader,
     Boolean _SetDeleted
     
     )
 {
     TypeId = _TypeId;
        Serial = _Serial;
        SignedUser = _SignedUser;
        Date = _Date;
        Printed = _Printed;
        DocumentShortName = _DocumentShortName;
        DocumentFullName = _DocumentFullName;
        MedexDataTable = _MedexDataTable;
        DocumentBody = _DocumentBody;
        DocumentHeader = _DocumentHeader;
        SetDeleted = _SetDeleted;
 }
开发者ID:oeai,项目名称:medx,代码行数:27,代码来源:Document.cs


示例10: WaitAsync

        public Task<bool> WaitAsync(Int32 duration, CancellationToken token)
        {
           VerboseLog("{0:000}|{1}|async wait requested", Thread.CurrentThread.Id, _id);

            CheckDisposed();
            token.ThrowIfCancellationRequested();

            if (_sem.TryAcquire())
            {
                VerboseLog("{0:000}|{1}|async wait immediate success", Thread.CurrentThread.Id,_id);
                return Task.FromResult(true);
            }
                

            if(duration == 0)
                return Task.FromResult(false);
            
            if (_asyncWaiters == null)
            {
                lock (this)
                {
                    if (_asyncWaiters == null)
                        _asyncWaiters = new ConcurrentLinkedQueue<AsyncWaiter>();
                }
            }

            AsyncWaiter waiter = new AsyncWaiter();
            TaskCompletionSource<bool> task = new TaskCompletionSource<bool>();
            
            waiter.Task = task;

            if (duration != -1)
            {
                waiter.CancelDelay = new CancellationTokenSource();
                waiter.Delay = Task.Delay(duration, waiter.CancelDelay.Token);
                waiter.Delay.ContinueWith(new ActionContinuation(() => TimeoutAsync(waiter)));
            }

            if (token != CancellationToken.None)
            {
                waiter.CancelRegistration = token.Register(() => CancelAsync(waiter));
            }
         
            _asyncWaiters.Add(waiter);

            VerboseLog("{0:000}|{1}|async wait enqued: {2:X}; {3}", Thread.CurrentThread.Id, _id, waiter.GetHashCode(), waiter.Task.Task.Id);

            if (_wasDisposed || token.IsCancellationRequested || waiter.Delay != null && waiter.Delay.IsCompleted)
            {
                // Mitigate the above race where a finishing condition occured
                // before where able to add our waiter to the waiters list.
                if (_asyncWaiters.Remove(waiter))
                {
                    CleanUpWaiter(waiter);
                }
            }

            return task.Task;
        }
开发者ID:sebastianhaba,项目名称:api,代码行数:59,代码来源:SemaphoreSlim.cs


示例11: AnnounceInfo

            public AnnounceInfo(IEnumerable<EndPoint> peers, Int32 a, Int32 b, Int32 c)
            {
                Peers = peers;

                WaitTime = a;
                Seeders = b;
                Leachers = c;
            }
开发者ID:HaKDMoDz,项目名称:eStd,代码行数:8,代码来源:BaseScraper.cs


示例12: Int32

        public static byte[] Int32(Int32 i, Endianness e = Endianness.Machine)
        {
            byte[] bytes = BitConverter.GetBytes(i);

            if (NeedsFlipping(e)) Array.Reverse(bytes);

            return bytes;
        }
开发者ID:HaKDMoDz,项目名称:eStd,代码行数:8,代码来源:Pack.cs


示例13: UInt32

        public static UInt32 UInt32(byte[] bytes, Int32 start, Endianness e = Endianness.Machine)
        {
            byte[] intBytes = Utils.GetBytes(bytes, start, 4);

            if (NeedsFlipping(e)) Array.Reverse(intBytes);

            return BitConverter.ToUInt32(intBytes, 0);
        }
开发者ID:alex-kir,项目名称:System.Net.Torrent,代码行数:8,代码来源:Unpack.cs


示例14: SetInt32

        public static void SetInt32(this Byte[] buffer, Int32 value, Int32 pos)
        {
            Byte[] copybuffer;

            copybuffer = BitConverter.GetBytes(value);
            Array.Reverse(copybuffer);
            Array.Copy(copybuffer, 0, buffer, pos, 4);
        }
开发者ID:ConstObject,项目名称:COD_MP,代码行数:8,代码来源:IW6MP.cs


示例15: RequestAdd

 public RpcHeader RequestAdd(Int32 a, Int32 b)
 {
     var packetId = Interlocked.Increment(ref globalPacketId);
     return w.Request(() => {
     w.Write(a);
     w.Write(b);
     }, length => new RpcHeader((int)MethodId.Add, (uint)packetId, length));
 }
开发者ID:hythof,项目名称:csharp,代码行数:8,代码来源:RpcGenerateRequest.cs


示例16: RegexTree

 internal RegexTree(RegexNode root, Dictionary<Int32, Int32> caps, Int32[] capnumlist, int captop, Dictionary<String, Int32> capnames, String[] capslist, RegexOptions opts)
 {
     _root = root;
     _caps = caps;
     _capnumlist = capnumlist;
     _capnames = capnames;
     _capslist = capslist;
     _captop = captop;
     _options = opts;
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:10,代码来源:RegexTree.cs


示例17: User

        public User(string login, UInt64 passwordHash, Int32 ID)
        {
            pLogin = login;
            pPassword = new Password(passwordHash);
            pID = ID;

            pStaticAddressess = new List<UnifiedAddress>();
            pDynamicAddressess = new List<UnifiedAddress>();
            pCurrentAddress = null;
        }
开发者ID:Expro,项目名称:Filechronization,代码行数:10,代码来源:User.cs


示例18: RegexTree

 internal RegexTree(RegexNode root, Hashtable caps, Int32[] capnumlist, int captop, Hashtable capnames, String[] capslist, RegexOptions opts)
 {
     _root = root;
     _caps = caps;
     _capnumlist = capnumlist;
     _capnames = capnames;
     _capslist = capslist;
     _captop = captop;
     _options = opts;
 }
开发者ID:geoffkizer,项目名称:corefx,代码行数:10,代码来源:RegexTree.cs


示例19: GetUInt32

        public static UInt32 GetUInt32(this Byte[] buffer, Int32 pos)
        {
            Byte[] copybuffer;

            copybuffer = new Byte[4];
            Array.Copy(buffer, pos, copybuffer, 0, 4);
            Array.Reverse(copybuffer);

            return BitConverter.ToUInt32(copybuffer, 0);
        }
开发者ID:ConstObject,项目名称:COD_MP,代码行数:10,代码来源:IW6MP.cs


示例20: Tok

        /// <summary>Returns the next token in <paramref name="str"/> from position <paramref name="start"/>. Barring whitespace, it returns the sequence of characters from <paramref name="start"/> that share the same unicode category.</summary>
        public static String Tok(this String str, ref Int32 start)
        {
            if(start >= str.Length) throw new ArgumentOutOfRangeException("start");

            Int32 i = start;

            StringBuilder sb = new StringBuilder();

            Char c = str[i];

            // skip whitespace
            while( i < str.Length ) {

                c = str[ i ];
                if( !Char.IsWhiteSpace( c ) ) break;
                i++;
            }
            if( Char.IsWhiteSpace( c ) ) {
                start = str.Length;
                return null; // then it's got some trailing whitespace left, and it's at the end
            }

            Boolean doneRadixPoint = false;
            UnicodeCategory currentCat, initialCat;
            Char initialChar = c;
            initialCat = currentCat = Char.GetUnicodeCategory( c );

            // special case for ( and )
            if( initialChar == '(' || initialChar == ')' ) {
                start = i + 1;
                return initialChar.ToString();
            }

            while( i < str.Length && CategoryEquals(initialCat, currentCat) ) {

                c = str[i];
                sb.Append( str[i++] );

                if( i >= str.Length ) break;

                currentCat = Char.GetUnicodeCategory(str, i);

                // special case exception for radix points, there can only be 1
                if( initialCat == UnicodeCategory.DecimalDigitNumber && str[i] == '.' && !doneRadixPoint) {
                    currentCat = UnicodeCategory.DecimalDigitNumber;
                    doneRadixPoint = true;
                }

            }

            start = i;

            return sb.ToString();
        }
开发者ID:vogon,项目名称:Demotic,代码行数:55,代码来源:Extensions.cs



注:本文中的Int32类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Int3264类代码示例发布时间:2022-05-24
下一篇:
C# Int2类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap