We generalize the Shannon classical sampling theorem by the theory of self-adjoint extensions of a symmetric operator with deficiency indices (1,1) in Hilbert space. The starting observation is that the Fourier transform of the space of bandlimited functions is invariant under the derivative operator. Hence, in time domain, one can interpret the sampling function space as the invariant domain of the multiplication operator T where T f(t) = t f(t). The operator T is known as a simple symmetric operator with deficiency indices (1,1). Such an operator has a one-parameter family of self-adjoint extensions. Each self-adjoint extension has a set of eigenvalues. The uniform Nyquist sampling points in the classical sampling theorem correspond to the eigenvalues of these self-adjoint extensions, and the shifted sinc reconstruction kernels correspond to the eigenvectors. In the special case of Shannon, the eigenvalues of each self-adjoint extension of T has an equidistant spacing. This leads to the uniform sampling in Shannon sampling. By considering a general symmetric operator T, we generalize the Shannon sampling to allow non-uniformly distributed points. The function space is the domain of T. Functions in this space possess a `time-varying bandwidth' in certain sense. An explicit expression of the generalized reconstruction is obtained. As an example, we will demonstrate how the amplitudes of Gibbs' overshoots in approximating a step function can be strongly reduced by choosing a higher local sampling density near a jump point.