Microsoft.Win32.Win32RegistryApi.ValueCount C# (CSharp) Méthode

ValueCount() public méthode

public ValueCount ( RegistryKey rkey ) : int
rkey RegistryKey
Résultat int
		public int ValueCount (RegistryKey rkey)
		{
			int index, result, bufferCapacity;
			RegistryValueKind type;
			StringBuilder buffer = new StringBuilder (BufferMaxLength);
			
			IntPtr handle = GetHandle (rkey);
			for (index = 0; true; index ++) {
				type = 0;
				bufferCapacity = buffer.Capacity;
				result = RegEnumValue (handle, index, 
						       buffer, ref bufferCapacity,
						       IntPtr.Zero, ref type, 
						       IntPtr.Zero, IntPtr.Zero);

				if (result == Win32ResultCode.MarkedForDeletion)
					throw RegistryKey.CreateMarkedForDeletionException ();

				if (result == Win32ResultCode.Success || result == Win32ResultCode.MoreData)
					continue;
				
				if (result == Win32ResultCode.NoMoreEntries)
					break;
				
				// something is wrong
				GenerateException (result);
			}
			return index;
		}